fix(#290 review): drop stale cached children on boot + gate size warn (F1/F2/F3)
F1 (MEDIUM regression): a collapsed-but-cached branch showed STALE children on re-expand after reload (the cache keeps children of any ever-expanded branch; refreshOpenBranches only refreshes OPEN branches, but the fetch guard skips a branch that has cached children). New pruneCollapsedChildren(tree, openIds) resets children to [] (keeps hasChildren) for every node NOT in the persisted open-set, recursing into open nodes — a once-per-mount boot effect. A pruned collapsed branch is then the 'unloaded' shape handleToggle re-fetches, so its first expand reconciles fresh (as pre-cache). Open branches keep their children (refreshOpenBranches handles them, no double fetch). Test: a collapsed cached branch with a stale child fetches fresh on first expand after boot. F2: gate the >4MB size-guard console.warn behind the writeFailureWarned once-flag (like the quota branch) so editing a huge tree no longer re-warns every ~500ms; test that an oversized tree is not persisted + warns exactly once. F3: narrow the use-auth privacy comment (only tree caches are swept; other localStorage entries remain). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -123,8 +123,10 @@ export default function useAuth() {
|
||||
|
||||
const handleLogout = async () => {
|
||||
setCurrentUser(RESET);
|
||||
// Purge the persisted sidebar tree caches (they contain page titles) so
|
||||
// nothing readable is left in localStorage on a shared machine.
|
||||
// Purge the persisted sidebar tree caches (they contain page titles) so the
|
||||
// cached page titles aren't left readable in localStorage on a shared
|
||||
// machine. (Only the tree caches are swept; other localStorage entries
|
||||
// remain.)
|
||||
clearPersistedTreeCaches();
|
||||
await logout();
|
||||
window.location.replace(`${APP_ROUTE.AUTH.LOGIN}?logout=1`);
|
||||
|
||||
Reference in New Issue
Block a user