Skip to content

fix(platform): resolve selected teams from current list - #4193

Merged
yannickmonney merged 1 commit into
mainfrom
fix/team-detail-current-name
Oct 4, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/team-detail-current-name

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What changed

  • Store the selected team id and resolve it against the current Teams list, so a successful rename updates the open detail instead of keeping its pre-write snapshot.
  • Reset the editor from the saved name when clean or closed; preserve an open dirty name across list replacements until explicit Cancel. Key detail content by team id so another identity cannot inherit its form.
  • Add component regressions for successful rename/title/Cancel baseline, close/reopen, duplicate-name refusal, dirty-draft retention, and clean-editor refresh. Register this coverage in the manual automation register.

Verification

  • Baseline 0592b64a9a02e44a442ef66bef0ca2781c011dc6: new regression 3 failed / 1 passed before production changes; duplicate refusal control passed.
  • After fix: 50 passed across 6 scoped jsdom suites (TeamsTable, rename regression, TeamEditDialog, lapsed-session controls, row actions, table config).
  • 75 passed across single-failure-toast and error-description guards.
  • Scoped TypeScript API check: 10 changed/test/importer files, transitive imports resolved; passed.
  • Scoped lint and format, manual-register gate and git diff --check: passed.
  • The tests use actual table/dialog/form controls, React Hook Form and QueryClient with the production org-team query key. Auth writes and member-directory reads are inert fixtures; membership mutation spies remain uncalled. This is component/query evidence, not native Better Auth/SQL or layout evidence.
  • EN/DE/FR strings and docs behavior remain unchanged. No accessibility markup, security boundary or schema/migration changes.
  • Browser/visual execution deferred to CI/independent review under the light-only dispatch; no visual-pass claim. Existing Bug: Team membership refresh silently replaces unsaved roster selections #3584 and Bug: Team editor accepts new typing during Save then closes with that newer draft unsaved #3585 membership/pending-save issues are outside this fix.

Closes #3934

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent review of PR #4193 at 9e75546c3f13b52e5d9bd7e60f75383f0b668303: accepted, with LOW follow-ups.

  • Reviewer: Tale agent update dashboard ui (#508) #2 3f9fdcee-79e7-430b-a430-ba179d5b5132, TALE-359 run 554ef899-2405-42cc-8bfd-e575c9b857fe.
  • Implementation: agent dce9fe1e, TALE-349 run ef876e5d; its final handoff says the head is ready. The runs are distinct.
  • Method: one read-only source reviewer, whose claims I cross-checked, plus my own runs.

Runtime (mine)

  • Negative control: with main's teams-table.tsx and team-edit-dialog.tsx, the head's teams-table.rename.test.tsx fails 3 of 4. The duplicate-name control passes. At the head it passes 4/4.
  • CI at this head is terminal: 50 success, 12 skipped by design, Trivy neutral. UI ran from a cache miss, and all 16 Playwright shards passed.

Verified from source

  • The selection is resolved by id against the unfiltered team list (teams-table.tsx:50-51), so it survives search and pagination.
  • A rename refreshes the open detail view. The save awaits an invalidation of the team prefix, which matches the list key, and the title reads the current team.name.
  • Closing the editor resets it to the refetched name. This covers Cancel, Escape and an overlay click, which all go through handleOpenChange.
  • Drafts are handled as intended:
    • an open, dirty name survives a list replacement;
    • a clean open editor refreshes;
    • a duplicate-name refusal keeps the draft.
  • No crash when the team disappears, and the other consumers read current data.
  • Mutants caught: going back to storing the object, always resetting, resetting only when closed, and dropping the team.name dependency.

LOW (follow-ups)

  1. The !open half of the reset rule is untested. The mutant if (!formState.isDirty) survives. After a successful rename, a reopened editor would show Save enabled, and later renames by others wouldn't show. Test: rename, reopen, Save disabled; then a newer name while closed shows on reopen.
  2. A kept draft can still be overwritten.
    • Another admin renames the team while you're typing, so the baseline stays the old name.
    • Typing back to exactly the old name makes the form clean, and the field then jumps to the new name.
    • Fix: move the baseline on a team.name change while keeping dirty values.
  3. A concurrent delete closes the open dialogs silently and loses the draft. selectedTeamId is never cleared. Clear it when the team is missing; optionally show a "team no longer exists" notice.
  4. INFO:
    • key={selectedTeam.id} has no observable effect.
    • The row-actions editor shares the changed effect, but no test renders it.

Merge: squash with --match-head-commit through my gate, which does a dry run first.

@yannickmonney
yannickmonney merged commit 272f60a into main Oct 4, 2026
@yannickmonney
yannickmonney deleted the fix/team-detail-current-name branch October 4, 2026 03:15
Sign up for free to 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.

Bug: team detail keeps the old name after a successful rename

1 participant