Skip to content

Commit f3b1d2b

Browse files
authored
Merge pull request #273 from middlewarehq/GROW-1452
chore: Update useRedirectWithSession logic in useRoute.ts
2 parents 59ec652 + f8e0f18 commit f3b1d2b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

web-server/src/constants/useRoute.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,27 @@ export const useRedirectWithSession = () => {
2828
org?.integrations?.bitbucket;
2929

3030
useEffect(() => {
31-
if (!orgId) return;
31+
if (!orgId || !router.isReady) return;
3232
if (!isOrgWelcomed) {
3333
depFn(router.replace, ROUTES.WELCOME.PATH);
3434
return;
3535
}
36-
if (!isOneCodeProviderIntegrated || !anyTeamEverExisted) {
36+
if (!isOneCodeProviderIntegrated) {
3737
depFn(router.replace, ROUTES.INTEGRATIONS.PATH);
3838
return;
3939
}
40+
if (!anyTeamEverExisted) {
41+
depFn(router.replace, ROUTES.TEAMS.PATH);
42+
return;
43+
}
4044
depFn(router.replace, defaultRoute.PATH);
4145
}, [
4246
anyTeamEverExisted,
4347
defaultRoute.PATH,
4448
isOneCodeProviderIntegrated,
4549
isOrgWelcomed,
4650
orgId,
51+
router.isReady,
4752
router.replace
4853
]);
4954
};

0 commit comments

Comments
 (0)