fix(FN-949): prevent bounce-back on Projects nav and show in mobile overflow

clearCurrentProject was triggering auto-reselect in useCurrentProject,
making the Projects button ineffective for single-project users. Added
explicit-clear flag to suppress auto-select. Also changed mobile overflow
menu to show Projects for single-project users (was gated to 2+ projects).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-04 20:30:24 -07:00
parent 44447af7a9
commit 47c805cb18
5 changed files with 24 additions and 19 deletions

View File

@@ -143,13 +143,13 @@ describe("useCurrentProject", () => {
result.current.clearCurrentProject();
});
// With available projects, it re-defaults to first active and saves to localStorage
// After explicit clear, should stay null (no auto-select) so user can view overview
await waitFor(() => {
expect(result.current.currentProject?.id).toBe("proj_1");
expect(result.current.currentProject).toBeNull();
});
// After re-defaulting, localStorage should have the default project
expect(localStorage.getItem("kb-dashboard-current-project")).toContain("proj_1");
// localStorage should be cleared
expect(localStorage.getItem("kb-dashboard-current-project")).toBeNull();
});
it("handles localStorage errors gracefully", async () => {