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/MainLayout/EmbeddedPreload.tsx

23 lines
604 B

import type { ReactElement, ReactNode } from 'react';
import { useEffect } from 'react';
import { RoomsCachedStore, SubscriptionsCachedStore } from '../../../cachedStores';
import PageLoading from '../PageLoading';
import { useMainReady } from '../hooks/useMainReady';
const EmbeddedPreload = ({ children }: { children: ReactNode }): ReactElement => {
const ready = useMainReady();
useEffect(() => {
SubscriptionsCachedStore.setReady(true);
RoomsCachedStore.setReady(true);
}, [ready]);
if (!ready) {
return <PageLoading />;
}
return <>{children}</>;
};
export default EmbeddedPreload;