fix(web): clear a sidebar scope stuck on No project #17104
main fromrefs/pull/17104/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
maria-rcks closed this
maria-rcks reopened this
juliusmarminge added labelsmacroscope-review
- apps/web/src/components/Sidebar.tsx lines 2499 to 2507OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -2487,6 +2489,19 @@2487- const nextKey = resolveSidebarProjectScopeKey({2489+ const resolvedKey = resolveSidebarProjectScopeKey({24882490 groups: projectGroups,24892491 key: persistedProjectScopeKey,24902492 settings: projectGroupingSettings,2491- canClearMissingScope: allProjectSnapshotsReady && allProjectConfigsReady,2493+ canClearMissingScope: projectCatalogReady,24922494 });2495+ const resolvedGroup =2496+ resolvedKey === null2497+ ? null2498+ : (projectGroups.find((group) => group.projectKey === resolvedKey) ?? null);2499+ const nextKey = shouldClearPersistedSidebarProjectScope({2500+ scopeKey: resolvedKey,2501+ snapshotsReady: projectCatalogReady,2502+ scopedGroup: resolvedGroup,2503+ scratchWorkspaceRootFor: (environmentId) =>2504+ serverConfigs.get(environmentId)?.scratchWorkspaceRoot,2505+ })2506+ ? null2507+ : resolvedKey;
- apps/web/src/components/Sidebar.tsx line 1025OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1008,3 +1013,13 @@10081013 clearSelection();10091014 setPersistedProjectScopeKey(null);10101015 }, [clearSelection, revealWidensScope, setPersistedProjectScopeKey]);1016+ // A restored Scratch scope is a real group, so the missing-project read leaves1017+ // its stored key in place and the sidebar stays filtered. Clear that key once1018+ // the catalog is ready. Pass the resolved key: a missing project stays stored1019+ // until it returns. A Scratch scope picked in this session stays.1020+ useEffect(() => {1021+ if (1022+ !shouldClearPersistedSidebarProjectScope({1023+ scopeKey: chosenProjectScopeKey,1024+ snapshotsReady: projectCatalogReady,1025+ restored: !userChoseProjectScopeRef.current,
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
tanstack-source added labelsbug
macodev00(GitHub profile, opens in a new tab) linked this to fix #16692
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
[before.mp4 (download)](https://raw.githubusercontent.com/macodev00/t3code/47e8656fe75d817bfc60f90ec1aadef37b7ea303/issue-16692/before/recording.mp4)
[after.mp4 (download)](https://raw.githubusercontent.com/macodev00/t3code/47e8656fe75d817bfc60f90ec1aadef37b7ea303/issue-16692/after/recording.mp4)
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed