Fix error messages on sign up (#10399)
In this PR: - adding logs to track workspace creation performance - refactor useIsWorkspaceSuspended to be more generic - only fetch favorites and views if workspace is Active to avoid error messages on sign up (workspace is not created yet)
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState';
|
||||
import { PrefetchKey } from '@/prefetch/types/PrefetchKey';
|
||||
import { useIsWorkspaceActivationStatusSuspended } from '@/workspace/hooks/useIsWorkspaceActivationStatusSuspended';
|
||||
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared';
|
||||
|
||||
export const useIsPrefetchLoading = () => {
|
||||
const isWorkspaceSuspended = useIsWorkspaceActivationStatusSuspended();
|
||||
const isWorkspaceActive = useIsWorkspaceActivationStatusEqualsTo(
|
||||
WorkspaceActivationStatus.ACTIVE,
|
||||
);
|
||||
const isFavoriteFoldersPrefetched = useRecoilValue(
|
||||
prefetchIsLoadedFamilyState(PrefetchKey.AllFavoritesFolders),
|
||||
);
|
||||
@ -14,7 +17,7 @@ export const useIsPrefetchLoading = () => {
|
||||
);
|
||||
|
||||
return (
|
||||
!isWorkspaceSuspended &&
|
||||
isWorkspaceActive &&
|
||||
(!areFavoritesPrefetched || !isFavoriteFoldersPrefetched)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user