Skip to content

Commit 0c13cb1

Browse files
committed
fix: explicitly check query result state in EmbeddedPreload
1 parent 2513201 commit 0c13cb1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/meteor/client/views/root/MainLayout/EmbeddedPreload.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const EmbeddedPreload = ({ children }: { children: ReactNode }): ReactElement =>
3939

4040
const shouldFetch = !!roomParams && !!uid;
4141

42-
const { isLoading } = useQuery({
42+
const { isLoading, isSuccess, isError } = useQuery({
4343
queryKey: roomParams ? roomsQueryKeys.roomReference(roomParams.reference, roomParams.type, uid ?? undefined) : [],
4444
queryFn: async () => {
4545
if (!roomParams) {
@@ -63,11 +63,11 @@ const EmbeddedPreload = ({ children }: { children: ReactNode }): ReactElement =>
6363
});
6464

6565
useEffect(() => {
66-
if (!shouldFetch || !isLoading) {
66+
if (!shouldFetch || isSuccess || isError) {
6767
SubscriptionsCachedStore.setReady(true);
6868
RoomsCachedStore.setReady(true);
6969
}
70-
}, [shouldFetch, isLoading]);
70+
}, [shouldFetch, isSuccess, isError]);
7171

7272
if (!ready || (shouldFetch && isLoading)) {
7373
return <PageLoading />;

0 commit comments

Comments
 (0)