Skip to content

Fix: header stat counts not updating after bulk-assign or revoke on Contract Admin page#3581

Open
daniellefrappier18 wants to merge 1 commit into
mainfrom
daniellef/update-counts-on-bulk-assisgnments
Open

Fix: header stat counts not updating after bulk-assign or revoke on Contract Admin page#3581
daniellefrappier18 wants to merge 1 commit into
mainfrom
daniellef/update-counts-on-bulk-assisgnments

Conversation

@daniellefrappier18

@daniellefrappier18 daniellefrappier18 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

Description (What does it do?)

The Contract Admin page header shows stat counts (Unassigned, Pending claim, etc.) derived from the contract detail query. Bulk-assigning seats or revoking a code mutates those counts server-side, but the contractDetail query wasn't being invalidated on mutation, so the header stayed stale until a full page refresh.

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots
counts.mov

How can this be tested?

  1. Navigate to a Contract Admin page for an org with an active contract
  2. Note the Unassigned and Pending claim counts in the header.
  3. Bulk-assign one or more seats via email (paste an email, click Assign Seats, confirm the send)
  4. Confirm the header's Unassigned count decreases and Pending claim increases immediately — no manual page refresh needed.
  5. From the codes table, open More actions on an assigned-but-unredeemed code and click Release seat (revoke), then confirm.
  6. Confirm the header's Unassigned count increases and Pending claim decreases immediately.

Additional Context

@daniellefrappier18 daniellefrappier18 marked this pull request as ready for review July 7, 2026 15:26
Copilot AI review requested due to automatic review settings July 7, 2026 15:26

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, push a new commit or reopen this pull request to trigger a review.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes stale header stat counts on the Contract Admin page by ensuring the contract detail React Query cache is invalidated after mutations that change server-side seat counts (bulk-assign and revoke). This aligns the UI header (Unassigned / Pending claim) with the latest backend state without requiring a full page refresh.

Changes:

  • Invalidate the managerOrganizationKeys.contractDetail(...) query after bulk seat assignment and code revocation mutations.
  • Add ContractAdminPage tests that simulate post-mutation contract-detail changes and assert header counts update accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
frontends/main/src/app-pages/ContractAdminPage/ContractAdminPage.test.tsx Adds regression tests verifying header stat counts refresh after bulk-assign and revoke actions.
frontends/api/src/mitxonline/hooks/organizations/index.ts Invalidates the contract detail query on seat-assign and revoke mutations so the header stats refetch and update.

@daniellefrappier18 daniellefrappier18 added the Needs Review An open Pull Request that is ready for review label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants