Skip to content

fix(client): clear stale collaborator dropdown error on retry - #91

Open
Alimedhat000 wants to merge 1 commit into
developfrom
fix/89-collaborator-error-clearing
Open

fix(client): clear stale collaborator dropdown error on retry#91
Alimedhat000 wants to merge 1 commit into
developfrom
fix/89-collaborator-error-clearing

Conversation

@Alimedhat000

Copy link
Copy Markdown
Owner

Summary

useCollaborators only reset its error inside the initial fetch effect, so once a add/remove failed, the alert ("Failed to add collaborator" / "Failed to remove collaborator") persisted indefinitely — even after a successful retry or closing/reopening the dropdown (the hook stays mounted with the document).

Fix: reset error at the start of each addCollaborator / removeCollaborator attempt, mirroring what the fetch effect already does. Failures still set a fresh message; successes now clear it.

Test plan

  • New hook-level tests in client/src/hooks/__tests__/use-collaborators.test.tsx run in a new browser-unit vitest browser project (stories can't exercise API-dependent logic). Watched the two recovery tests fail on the unfixed code (stale error asserted), pass after the fix.
  • Full client suite: 40 files / 139 tests passing
  • pnpm --filter client lint and typecheck clean

useCollaborators only reset its error inside the initial fetch effect, so
a failed add or remove left 'Failed to add/remove collaborator' showing
indefinitely — even after a successful retry or closing/reopening the
dropdown. Reset the error at the start of each action, mirroring the
fetch effect.
Adds a browser-mode vitest project for hook-level tests (stories can't
exercise API-dependent logic) with coverage for error clearing on
successful retries.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Alimedhat000