Show the folder tree in a shared account #93

Closed
opened 2026-08-27 16:51:39 +00:00 by jcoffey-dev · 0 comments
Owner

Switching to an account someone had shared showed an empty folder tree. Their files listed fine; the sidebar beside them was blank, with nothing to say why.

A regression from #92, found in real use on a share between two accounts — which is exactly where it would show up, since the tree is built from a query that has already run for your own account and so only breaks on the switch.

Cause

The account switch cleared nodes and children and stopped there:

  • treeLoaded stayed true from the previous account. The sidebar only asks for folders when it is false, so it never asked again.
  • dirIds still named the previous account's folders, which no longer resolved against the cleared nodes.

Empty tree either way, and no error, because nothing had failed.

Fix

The fields belonging to one account are named in one place now — emptyForAccount — and the test asserts the whole set, not the fields that come to mind. This wasn't bad logic; it was a field nobody remembered when two more were added a commit earlier, and asserting the set is the only guard that survives the next two.

319 web and 77 server tests pass, five new. npm run typecheck clean.

Not in this PR

Three other things came out of the same test, none of them regressions, all worth their own change:

  • Switching to a shared account also points mail, calendar and contacts at it, because accountFor routes every capability the selected account advertises. That needs its own look.
  • A shared account is only reachable from the profile menu, which is not where anyone would look for shared files.
  • After a share was removed, one browser kept offering the account switcher and the other didn't — consistent with the session refresh being driven by a push that only one of them got.

🤖 Generated with Claude Code

Merged 2026-08-27 as coffey-labs/ihasmail@cf9474ce35

Rebuilt from: git history, session transcript.

Switching to an account someone had shared showed an empty folder tree. Their files listed fine; the sidebar beside them was blank, with nothing to say why. A regression from #92, found in real use on a share between two accounts — which is exactly where it would show up, since the tree is built from a query that has already run for your own account and so only breaks on the switch. ### Cause The account switch cleared `nodes` and `children` and stopped there: - `treeLoaded` stayed `true` from the previous account. The sidebar only asks for folders when it is false, so it never asked again. - `dirIds` still named the previous account's folders, which no longer resolved against the cleared `nodes`. Empty tree either way, and no error, because nothing had failed. ### Fix The fields belonging to one account are named in one place now — `emptyForAccount` — and the test asserts the **whole set**, not the fields that come to mind. This wasn't bad logic; it was a field nobody remembered when two more were added a commit earlier, and asserting the set is the only guard that survives the next two. 319 web and 77 server tests pass, five new. `npm run typecheck` clean. ### Not in this PR Three other things came out of the same test, none of them regressions, all worth their own change: - Switching to a shared account also points **mail, calendar and contacts** at it, because `accountFor` routes every capability the selected account advertises. That needs its own look. - A shared account is only reachable from the profile menu, which is not where anyone would look for shared files. - After a share was removed, one browser kept offering the account switcher and the other didn't — consistent with the session refresh being driven by a push that only one of them got. 🤖 Generated with [Claude Code](https://claude.com/claude-code) **Merged** 2026-08-27 as coffey-labs/ihasmail@cf9474ce351f <sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.