Problem
client/src/hooks/use-collaborators.ts sets error in three places but only ever clears it at the start of a full refetch (setError(null) inside the docId effect, line 27):
- `Failed to add collaborator` (line 62, add failure)
- `Failed to remove collaborator` (line 49, remove failure)
- `Failed to load collaborators` (line 33, fetch failure)
Once any of these is set, the message persists indefinitely for as long as the hook is mounted with the same `docId`:
- Successful retry doesn't clear it — `addCollaborator`'s success path (lines 56–59) never calls `setError(null)`, so the banner stays even though the collaborator was actually added.
- Closing and reopening the dropdown doesn't clear it — state lives in the hook, which stays mounted with the document.
- A successful `removeCollaborator` likewise never clears a previously-set error.
Impact
Users see a stale "Failed to add collaborator" alert next to a collaborator list that visibly does contain the just-added person. Contradictory UI; looks broken.
Fix
Clear the error at the natural transitions:
- reset `error` at the start of `addCollaborator` / `removeCollaborator` attempts (mirroring what the fetch effect already does), or
- clear it in each action's success path
Optionally also derive display from the most recent operation only.
Related: the `AddFailureShowsError` story (`collaborators-dropdown.stories.tsx`) exercises the error path but nothing asserts error clearing on recovery — worth adding once fixed.
Problem
client/src/hooks/use-collaborators.tssetserrorin three places but only ever clears it at the start of a full refetch (setError(null)inside thedocIdeffect, line 27):Once any of these is set, the message persists indefinitely for as long as the hook is mounted with the same `docId`:
Impact
Users see a stale "Failed to add collaborator" alert next to a collaborator list that visibly does contain the just-added person. Contradictory UI; looks broken.
Fix
Clear the error at the natural transitions:
Optionally also derive display from the most recent operation only.
Related: the `AddFailureShowsError` story (`collaborators-dropdown.stories.tsx`) exercises the error path but nothing asserts error clearing on recovery — worth adding once fixed.