The client resolves role from account metadata and falls back to worker. The role context exposes an isLoaded flag so nav and tab gates do not render the wrong screen during the moment before the identity provider hydrates.
Also called: default role · new user sees everything · signed in and saw the whole app
- 1getRoleFromClerk defaults to worker when metadata carries no role.
- 2The deprecated localStorage role mirror also defaults to worker.
- 3RoleContext exposes isLoaded; the settings deep-link guard only acts once the role is loaded, so a real admin is never bounced mid-load.
Both files record the same incident. roles.ts: 'Defaulting to admin here let any signed-in user with unset metadata see every nav tab, even though the server-side requireRole guards would 403 their actual data queries — the visible effect was I can see Sales Pipeline but it's empty (Danny's bug).' permissions.ts adds the mobile variant: an invitee with no localStorage state saw every nav tab even though their server-side role was worker.
- A missing role granted full navigation.
- Nav rendered against a placeholder role during hydration.
See it on your own jobs
Twenty minutes, your numbers, no slide deck. We’ll build one of your real buildings in front of you and send you the estimate link at the end — yours to keep either way.
or keep browsing features →