-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition while loading metadata on sign in (#9027)
- Loading branch information
1 parent
183fd87
commit 90c2664
Showing
9 changed files
with
89 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsGater.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
import { isAppWaitingForFreshObjectMetadataState } from '@/object-metadata/states/isAppWaitingForFreshObjectMetadataState'; | ||
import { UserOrMetadataLoader } from '~/loading/components/UserOrMetadataLoader'; | ||
|
||
export const ObjectMetadataItemsGater = ({ | ||
children, | ||
}: React.PropsWithChildren) => { | ||
const isAppWaitingForFreshObjectMetadata = useRecoilValue( | ||
isAppWaitingForFreshObjectMetadataState, | ||
); | ||
|
||
const shouldDisplayChildren = !isAppWaitingForFreshObjectMetadata; | ||
|
||
return ( | ||
<>{shouldDisplayChildren ? <>{children}</> : <UserOrMetadataLoader />}</> | ||
); | ||
}; |
6 changes: 6 additions & 0 deletions
6
...wenty-front/src/modules/object-metadata/states/isAppWaitingForFreshObjectMetadataState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { createState } from 'twenty-ui'; | ||
|
||
export const isAppWaitingForFreshObjectMetadataState = createState<boolean>({ | ||
key: 'isAppWaitingForFreshObjectMetadataState', | ||
defaultValue: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters