fix(front): defer default home redirect when object metadata is not loaded#20330
Open
charlesBochet wants to merge 1 commit intomainfrom
Open
fix(front): defer default home redirect when object metadata is not loaded#20330charlesBochet wants to merge 1 commit intomainfrom
charlesBochet wants to merge 1 commit intomainfrom
Conversation
…oaded After PR #20308 removed the mocked-metadata placeholder for authenticated users, useDefaultHomePagePath could observe an empty readableNonSystemObjectMetadataItems list during the post-login transition window (token set -> currentUser loaded -> workspace loaded -> metadata loaded). The empty-fallback then sent the user to /settings/profile, and because that path is not in ONBOARDING_PATHS / ONGOING_USER_CREATION_PATHS, the redirect logic never fired again to correct the destination once metadata finally arrived. The user was stranded on the profile settings page after every login - which is what was breaking the merge queue E2E tests (login.setup captured /settings/profile as LINK, then dependent tests like workflow-creation.spec.ts and signup_invite_email.spec.ts timed out clicking app navigation that did not exist on the settings page). Distinguish "user genuinely has no readable objects" from "object metadata has not loaded yet" by checking metadataStoreState status. When metadata is not yet up-to-date, defer to AppPath.Index so the memo recomputes once metadata loads and the user is redirected to their real home page. Add a regression test covering the not-loaded-yet case.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the merge-queue E2E failures introduced after #20308. After login, users were being silently redirected to
/settings/profileinstead of their workspace home, which broke every dependent E2E test that re-uses the post-login URL (workflow-creation.spec.ts,authentication/signup_invite_email.spec.ts, etc.).Root cause
useDefaultHomePagePathfalls back to/settings/profilewhenreadableNonSystemObjectMetadataItemsis empty. That list is empty in two cases:/settings/profileis the intended fallback.Before #20308 the frontend always loaded mocked metadata for authenticated users, so case (2) never happened. After #20308 mocked metadata is gone, and during the post-verify window (
handleLoadWorkspaceAfterAuthenticationfinishes,setIsAppEffectRedirectEnabled(true)re-enables redirects,PageChangeEffectfires) the metadata store is still empty. The hook then returns/settings/profile. Because that path is not inONBOARDING_PATHS/ONGOING_USER_CREATION_PATHS,usePageChangeEffectNavigateLocationdoesn't fire a corrective redirect once metadata finally loads — the user is stranded.login.setup.tscapturesprocess.env.LINK = page.url()after verify, so subsequent testsgoto(LINK)end up in Settings looking for app navigation that isn't there → click timeouts.Fix
Distinguish the two empty cases by reading
metadataStoreState('objectMetadataItems').status. If it isn't'up-to-date'we defer toAppPath.Indexinstead of/settings/profile. The memo recomputes when the status flips, and the user is then routed to their actual home page.A regression test is added in
useDefaultHomePagePath.test.tsfor the not-loaded-yet case.Test plan
npx jest src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts(5/5 pass, including new regression case)workflow-creation.spec.ts,authentication/signup_invite_email.spec.ts) pass on this branch/settings/profile