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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user