Skip to content

Reset replacement selection when the performance scale modal closes #474

Description

@coderabbitai

Summary

ReplacementSelectionModal retains selectedReplacementId after the modal closes.

Required change

Reset the selected replacement when the modal closes and when the target performance scale changes. The delete action must require a replacement selected during the current modal session.

Rationale

The parent keeps the modal component mounted. Closing it sets scaleToDelete to null, but the component state persists. When an administrator opens the modal again, the next delete request can submit the prior replacement ID.

Affected area

  • src/app/admin/performance/components/ReplacementSelectionModal.tsx
  • src/app/admin/performance/page.tsx

Acceptance criteria

  • Canceling the modal clears selectedReplacementId.
  • A successful replacement clears selectedReplacementId.
  • Opening the modal for a different performance scale starts with no replacement selected.
  • The Delete and Replace button remains disabled until the administrator selects a replacement in the current session.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions