bigbluebutton-Github/bigbluebutton-html5/client/main.tsx
prlanzarin 533c7e86dc fix(bbb-html5): add specific logCodes for root error boundaries
The ErrorBoundary component has a generic log message that is not
overridable and will aggregate errors from different components. The
ideal scenario is that log tags are configurable so that errors can be
filtered for in log post-processing.

Add the logMetadata: { logCode, logMessage } prop to the ErrorBoundary
component so that log tags are configurable. Default tags are
maintained.
Add specific log metadatas for the client startup error boundary
(logCode: 'app_startup_crash') and the user connection error boundary
(logCode: 'app_crash').
2024-05-03 15:27:17 +00:00

47 lines
2.1 KiB
TypeScript

import React from 'react';
import ConnectionManager from '/imports/ui/components/connection-manager/component';
// eslint-disable-next-line react/no-deprecated
import { render } from 'react-dom';
import SettingsLoader from '/imports/ui/components/settings-loader/component';
import ErrorBoundary from '/imports/ui/components/common/error-boundary/component';
import { ErrorScreen } from '/imports/ui/components/error-screen/component';
import PresenceManager from '/imports/ui/components/join-handler/presenceManager/component';
import LoadingScreenHOC from '/imports/ui/components/common/loading-screen/loading-screen-HOC/component';
import IntlLoaderContainer from '/imports/startup/client/intlLoader';
import LocatedErrorBoundary from '/imports/ui/components/common/error-boundary/located-error-boundary/component';
import StartupDataFetch from '/imports/ui/components/connection-manager/startup-data-fetch/component';
import GraphqlToMiniMongoAdapterManager from '/imports/ui/components/components-data/graphqlToMiniMongoAdapterManager/component';
const STARTUP_CRASH_METADATA = { logCode: 'app_startup_crash', logMessage: 'Possible startup crash' };
const APP_CRASH_METADATA = { logCode: 'app_crash', logMessage: 'Possible app crash' };
const Main: React.FC = () => {
// Meteor.disconnect();
return (
<StartupDataFetch>
<ErrorBoundary Fallback={ErrorScreen} logMetadata={STARTUP_CRASH_METADATA}>
<LoadingScreenHOC>
<IntlLoaderContainer>
{/* from there the error messages are located */}
<LocatedErrorBoundary Fallback={ErrorScreen} logMetadata={APP_CRASH_METADATA}>
<ConnectionManager>
<PresenceManager>
<GraphqlToMiniMongoAdapterManager>
<SettingsLoader />
</GraphqlToMiniMongoAdapterManager>
</PresenceManager>
</ConnectionManager>
</LocatedErrorBoundary>
</IntlLoaderContainer>
</LoadingScreenHOC>
</ErrorBoundary>
</StartupDataFetch>
);
};
render(
<Main />,
document.getElementById('app'),
);