The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/apps/meteor/client/views/root/AppLayout.tsx

85 lines
3.3 KiB

import { useEffect, Suspense, useSyncExternalStore } from 'react';
import DocumentTitleWrapper from './DocumentTitleWrapper';
import PageLoading from './PageLoading';
import { useAppleOAuth } from './hooks/customOAuth/useAppleOAuth';
import { useCustomOAuth } from './hooks/customOAuth/useCustomOAuth';
import { useDolphinOAuth } from './hooks/customOAuth/useDolphinOAuth';
import { useDrupalOAuth } from './hooks/customOAuth/useDrupalOAuth';
import { useGitHubEnterpriseOAuth } from './hooks/customOAuth/useGitHubEnterpriseOAuth';
import { useGitLabOAuth } from './hooks/customOAuth/useGitLabOAuth';
import { useNextcloudOAuth } from './hooks/customOAuth/useNextcloudOAuth';
import { useWordPressOAuth } from './hooks/customOAuth/useWordPressOAuth';
import { useAnalytics } from './hooks/useAnalytics';
import { useAnalyticsEventTracking } from './hooks/useAnalyticsEventTracking';
import { useAutoupdate } from './hooks/useAutoupdate';
import { useCodeHighlight } from './hooks/useCodeHighlight';
import { useCorsSSLConfig } from './hooks/useCorsSSLConfig';
import { useDesktopFavicon } from './hooks/useDesktopFavicon';
import { useDesktopTitle } from './hooks/useDesktopTitle';
import { useEmojiOne } from './hooks/useEmojiOne';
import { useEscapeKeyStroke } from './hooks/useEscapeKeyStroke';
import { useGoogleTagManager } from './hooks/useGoogleTagManager';
import { useIframeCommands } from './hooks/useIframeCommands';
import { useIframeLoginListener } from './hooks/useIframeLoginListener';
import { useLivechatEnterprise } from './hooks/useLivechatEnterprise';
import { useLoadMissedMessages } from './hooks/useLoadMissedMessages';
import { useLoadRoomForAllowedAnonymousRead } from './hooks/useLoadRoomForAllowedAnonymousRead';
import { useLoginViaQuery } from './hooks/useLoginViaQuery';
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
import { useNotificationPermission } from './hooks/useNotificationPermission';
import { useRedirectToSetupWizard } from './hooks/useRedirectToSetupWizard';
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
import { useStartupEvent } from './hooks/useStartupEvent';
import { appLayout } from '../../lib/appLayout';
const AppLayout = () => {
useEffect(() => {
document.body.classList.add('color-primary-font-color', 'rcx-content--main');
return () => {
document.body.classList.remove('color-primary-font-color', 'rcx-content--main');
};
}, []);
useIframeLoginListener();
useMessageLinkClicks();
useGoogleTagManager();
useAnalytics();
useEscapeKeyStroke();
useAnalyticsEventTracking();
useLoadRoomForAllowedAnonymousRead();
useNotificationPermission();
useEmojiOne();
useRedirectToSetupWizard();
useSettingsOnLoadSiteUrl();
useLivechatEnterprise();
useNextcloudOAuth();
useGitLabOAuth();
useGitHubEnterpriseOAuth();
useDrupalOAuth();
useDolphinOAuth();
useAppleOAuth();
useWordPressOAuth();
useCustomOAuth();
useCorsSSLConfig();
useAutoupdate();
useCodeHighlight();
useLoginViaQuery();
useLoadMissedMessages();
useDesktopFavicon();
useDesktopTitle();
useStartupEvent();
useIframeCommands();
Chore: Replace `useSubscription` with `useSyncExternalStore` (#25909) <!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. --> <!-- Your Pull Request name should start with one of the following tags [NEW] For new features [IMPROVE] For an improvement (performance or little improvements) in existing features [FIX] For bug fixes that affect the end-user [BREAK] For pull requests including breaking changes Chore: For small tasks Doc: For documentation --> <!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat - Lint and unit tests pass locally with my changes - I have added tests that prove my fix is effective or that my feature works (if applicable) - I have added necessary documentation (if applicable) - Any dependent changes have been merged and published in downstream modules --> ## Proposed changes (including videos or screenshots) <!-- CHANGELOG --> <!-- Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue below. This description will appear in the release notes if we accept the contribution. --> <!-- END CHANGELOG --> ## Issue(s) <!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 --> ## Steps to test or reproduce <!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable --> ## Further comments <!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
4 years ago
const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot);
return (
<Suspense fallback={<PageLoading />}>
<DocumentTitleWrapper>{layout}</DocumentTitleWrapper>
</Suspense>
);
};
export default AppLayout;