fix(app): unreadable permissions show a retry, never the form (V1-2.5 L1)
Owner checkpoint 2026-11-02: creation page checks loading, server refusal, failed read, then the editor rule; Administration home shows the same notice. reloadAccess re-reads roles and grants without wiping held state; refreshAccount (no caller) removed. Zone panel live region always mounted. Unit and e2e for reviewer-only and editor.
This commit is contained in:
1 parent
14ff890761
commit
4111efa1d1
15 files changed
+856
-56
No files matched your search
@@ -68,11 +68,16 @@ export interface AuthState {
|
||||
* Empty until loaded and when the read fails.
|
||||
*/
|
||||
catalogGrants: OwnCatalogGrant[]
|
||||
/** Whether `catalogGrants` is read yet: a display rule waits for `ready`, and a `failed` read leaves the decision to the server. */
|
||||
/** Whether `catalogGrants` is read yet: a display rule waits for `ready`; `failed` = the read failed, pages show the unavailable state and never deduce an absence of right from it. */
|
||||
catalogGrantsStatus: 'loading' | 'ready' | 'failed'
|
||||
/** Subscribes to the client; returns the unsubscribe. Safe to call twice. */
|
||||
start: () => () => void
|
||||
refreshAccount: () => Promise<void>
|
||||
/**
|
||||
* Reads the platform roles and own grants again after a failed permission
|
||||
* read (owner 2026-11-02): pages wait, then show what the answer gives; a
|
||||
* technical error never wipes what the account already holds. Never rejects.
|
||||
*/
|
||||
reloadAccess: () => Promise<void>
|
||||
/** Reads the personal workspace again (after a failure). */
|
||||
refreshWorkspace: () => Promise<void>
|
||||
updateProfile: (patch: OwnProfilePatch) => Promise<Profile>
|
||||
@@ -260,8 +265,21 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
return () => data.subscription.unsubscribe()
|
||||
},
|
||||
|
||||
refreshAccount: async () => {
|
||||
await loadAccount(requireClient(), requireUser(get().user), set, get)
|
||||
reloadAccess: async () => {
|
||||
const user = get().user
|
||||
const client = getSupabaseClient()
|
||||
if (!user || !client) return set({ catalogGrants: [], catalogGrantsStatus: 'failed' })
|
||||
const setOwn = setForUser(user, set, get)
|
||||
setOwn({ catalogGrantsStatus: 'loading' })
|
||||
try {
|
||||
const [roles, catalogGrants] = await Promise.all([
|
||||
fetchOwnPlatformRoles(client, user.id),
|
||||
listOwnCatalogGrants(client, user.id),
|
||||
])
|
||||
setOwn({ roles, catalogGrants, catalogGrantsStatus: 'ready' })
|
||||
} catch {
|
||||
setOwn({ catalogGrants: [], catalogGrantsStatus: 'failed' })
|
||||
}
|
||||
},
|
||||
|
||||
refreshWorkspace: async () => {
|
||||
|
||||
Reference in new issue
Block a user