fix(client-config): set isLoaded to false on API status update (#12371)
Attempt at #12289 (edit Félix: removed fix keyword since I don't think it fixes it) --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -28,7 +28,7 @@ export const useGetPublicWorkspaceDataByDomain = () => {
|
||||
origin,
|
||||
},
|
||||
skip:
|
||||
!clientConfigApiStatus.isLoaded ||
|
||||
!clientConfigApiStatus.isSaved ||
|
||||
(isMultiWorkspaceEnabled && isDefaultDomain) ||
|
||||
isDefined(workspacePublicData),
|
||||
onCompleted: (data) => {
|
||||
@ -38,9 +38,17 @@ export const useGetPublicWorkspaceDataByDomain = () => {
|
||||
setWorkspacePublicDataState(data.getPublicWorkspaceDataByDomain);
|
||||
},
|
||||
onError: (error) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
redirectToDefaultDomain();
|
||||
// Only redirect to default domain if it's a workspace not found error
|
||||
const isWorkspaceNotFoundError = error.graphQLErrors?.some(
|
||||
(graphQLError) => graphQLError.extensions?.code === 'NOT_FOUND',
|
||||
);
|
||||
|
||||
if (isWorkspaceNotFoundError) {
|
||||
redirectToDefaultDomain();
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user