Track tab by name + refresh session before reading user-info

Fixkamo-internal
Shipped
May 11, 2026 at 6:00 PM UTC
Author
kamo
Commit
cb377a5

Two related navigation bugs that both manifest as "the wrong tab opens": 1. SettingsView tracked the active tab by *index*. childrenArray can recompose between renders when conditional tabs (DocsTab, EmailMailboxTab, PhoneSettingsTab, PlansBillingTab, RolesPermissionsTab, etc.) become visible after useUserInfo resolves rights. An index recorded against the smaller initial array landed on a different child after the rebuild: - ?tab=audio-video → my-profile (audio-video wasn't in the initial array, findIndex returned -1, fallback was index 0). - ?tab=account-activity → docs (account-activity matched index 1 on first render before Docs showed up; Docs then took over index 1 after rights loaded, and Effect 1 helpfully rewrote the URL to ?tab=docs). Track activeTab by tab *name* (string) instead. Derive the index on every render. URL syncing waits until the named tab actually exists in childrenArray, so a transient miss during loading no longer hijacks navigation. 2. /settings/account redirects users without CONFIGURE_SYSTEM off the page at mount. Child-org owners have CONFIGURE_SYSTEM granted in member_rights_applied (right 20, verified via DB), but their *** can be stale on the very first page load — the rights array is baked at session creation, and the periodic 5-minute frontend refresh hasn't fired yet. Have /api/user-info call POST /api/security/session/refresh server-side before reading Redis so the very first /api/user-info call returns fresh rights. Silent on refresh failure: log + fall through to the existing Redis read so the page degrades to stale-rights mode instead of 500'ing.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing