Skip to content

Commit 9b19634

Browse files
committed
fix(web): read-only members never see write buttons flash — canWrite defaults closed
1 parent 06de78c commit 9b19634

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/web/src/components/workspace/FileBrowser.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,13 @@ export function FileBrowser({ scope }: { scope: FileScopeParams }) {
8787
const [editor, setEditor] = useState<{ url: string; token: string } | null>(null);
8888
// Mirrors the listing response's own `canWrite` (an org member vs.
8989
// owner/admin) — server-decided, never inferred client-side. Defaults to
90-
// `true` so the affordances don't flash-then-hide while the first load is
91-
// still in flight; the very first render is also `loading`, which already
92-
// hides them, so this default is never actually shown on its own.
93-
const [canWrite, setCanWrite] = useState(true);
90+
// `false`, fail-closed: the toolbar that renders these buttons is NOT
91+
// gated by `loading` (only the entries list below it is), so a `true`
92+
// default would let a read-only member see clickable Ordner/Hochladen
93+
// buttons for one frame before the first `load()` response flips this to
94+
// its real value. `load()` sets the real value on every successful
95+
// listing; a writer sees the buttons appear a frame later, not vanish.
96+
const [canWrite, setCanWrite] = useState(false);
9497

9598
/**
9699
* Start the OIDC hop and record that we did. `errorResponse` maps a

0 commit comments

Comments
 (0)