import * as React from 'react'; import '@patternfly/react-core/dist/styles/base.css'; import './app.css'; import { Alert, Bullseye, Button, Page, PageSection, PageSidebar, Spinner, Stack, StackItem, } from '@patternfly/react-core'; import { DeploymentMode, logout, useModularArchContext, useNamespaceSelector, useSettings, } from 'mod-arch-core'; import AppRoutes from '~/app/AppRoutes'; import { AppContext } from '~/app/context/AppContext'; const App: React.FC = () => { const { configSettings, userSettings, loaded: configLoaded, loadError: configError, } = useSettings(); const { namespacesLoaded, namespacesLoadError, initializationError } = useNamespaceSelector(); const { config } = useModularArchContext(); const { deploymentMode } = config; const isStandalone = deploymentMode === DeploymentMode.Standalone; const contextValue = React.useMemo( () => configSettings && userSettings ? { config: configSettings!, user: userSettings!, } : null, [configSettings, userSettings], ); const error = configError || namespacesLoadError || initializationError; const sidebar = ; // We lack the critical data to startup the app if (error) { // There was an error fetching critical data return (

{configError?.message || namespacesLoadError?.message || initializationError?.message || 'Unknown error occurred during startup'}

Logging out and logging back in may solve the issue

); } // Waiting on the API to finish const loading = !configLoaded || !userSettings || !configSettings || !contextValue || !namespacesLoaded; return loading ? ( ) : ( ); }; export default App;