Repository navigation
fix(web): stay on billing after subscription cancellation - #1092
Conversation
Reload the current billing page instead of navigating home after cancellation. Add regression coverage for refresh-on-success and error handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Reload account data without reloading the browser or navigating away. Close the confirmation dialog and preserve the success notification. Report account refresh failures separately from cancellation failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 143 |
| Duplication | 6 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryKeeps subscription cancellation on the billing page.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User confirms cancellation] --> B[Keep dialog open and spinner active]
B --> C[Request cancellation]
C --> D[Poll account]
D -->|Confirmed| E[Show updated billing details]
B -->|Ten seconds total| F[Show cancellation pending]
C -->|Request fails| G[Show error]
D -->|Refresh fails| G
E --> H[Close dialog and show one notice]
F --> H
G --> H
Reviews (2) · Last reviewed commit: "fix(web): confine subscription cancellat..." · Reviewed by Greptile |
There was a problem hiding this comment.
🟡 Changes recommended
The cancellation flow can leave active-plan controls visible after success, while refresh errors can overwrite the notification and obscure that cancellation succeeded.
2 open issues
What changed in this PR
This PR updates the web billing flow to keep users on the billing page after subscription cancellation and refresh account details in place.
Changes:
- Removes post-cancellation navigation, closes the confirmation dialog, and calls
authStore.loadUser(). - Separates cancellation and account-refresh error handling while retaining the success notification.
- Adds regression tests for successful cancellation, cancellation failure, and refresh failure.
| File | Description |
|---|---|
web/app/pages/billing/index.vue |
Updates cancellation handling to stay on billing and refresh account data. |
web/app/pages/billing/index.test.ts |
Adds cancellation-handler tests covering navigation, dialog state, and notifications. |
Review effort: Balanced
Poll account data briefly while showing a cancelled pending-details card. Avoid showing stale active-plan controls while the webhook is pending. Keep cancellation success context when account refresh returns an API error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🟡 Changes recommended
The cancellation flow can leave the pending card stuck after account updates, and polling continues after unmount, potentially updating shared state and posting notifications on another page.
2 open issues
2 resolved since last review
Review effort: Balanced
Limit the billing-status refresh wait to ten seconds, including slow requests. Keep the confirmation dialog open and non-dismissible while waiting. Emit one final notification rather than an initial and a follow-up toast. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Stop scheduling refreshes and suppress notifications when billing unmounts. Reveal the final plan card when late account data confirms cancellation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Abort billing refreshes on timeout and unmount, and guard stale account writes. Add mounted billing-card and dialog regression coverage using Vue's renderer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🟡 Changes recommended
Overlapping loadUser requests can discard a successful response when a newer request fails or aborts, leaving user null and causing initialization callers to permanently skip account event subscriptions.
3 open issues
2 resolved since last review
Review effort: Balanced
Only discard older responses when a newer account load has published data. Keep valid initialization results if a replacement refresh fails or aborts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because findings omitted from the published review include a critical race that can restore an invalidated API key and a cancellation dialog that can remain locked after a failed load.
No open issues 🎉
3 resolved since last review
Review effort: Balanced
Lock the dialog only during cancellation, not unrelated billing loading. Invalidate older refresh results when user updates or API-key rotation finish. Add mounted-dialog and refresh-versus-mutation regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
|
Addressed the two concerns mentioned in the latest review summary: successful account updates and API-key rotation invalidate earlier account refreshes, with regression tests for both. Dialog persistence and Keep Subscription disabling now use a cancellation-specific flag, so unrelated billing loading cannot lock the dialog; the mounted-component regression covers that case. All 104 web tests, targeted lint/format checks, and TypeScript checks pass. |
Track account-read freshness separately from mutation credential freshness. Preserve newer billing reads without restoring credentials from older requests. Cover both reply orderings for account updates and API-key rotation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🟡 Changes recommended
Overlapping auth requests can discard successful timezone and active-phone updates or leave both the user state and shared request header using an invalidated API key.
2 open issues
1 resolved since last review
Review effort: Balanced
Remove all shared auth-store coordination changes from this PR. Keep refreshed billing data local to the page without updating credentials. Cap the entire cancellation flow at ten seconds with one progress notification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🟡 Changes recommended
Billing can retain or publish a previous account’s details after logout or an account switch because session changes do not clear cached state or invalidate pending operations.
1 open issue
2 resolved since last review
Review effort: Balanced
Discard the billing snapshot and stop pending page work when the account changes. Do not change the auth store or logout behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed to evaluate stale subscription state after same-account updates and the inability to observe late cancellation confirmation once polling stops.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Clear the page-local override when newer shared account data arrives. Keep the ten-second cancellation deadline and auth store behavior unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
|
Addressed the same-account stale-card concern in the latest review summary: a newer shared account snapshot now clears the billing-page override, with a mounted regression that transitions the same account from cancelled to expired/free. Stopping polling after ten seconds and displaying Cancellation is in progress is intentional and explicitly requested by the user; no second automatic notification or indefinite waiting is desired. Auth-store files remain unchanged from main. All 101 tests and targeted lint/type checks pass. |
Keep the billing-page cancellation snapshot when an older active-state read arrives. Still reflect confirmed shared cancellation or free-plan updates and account changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4


Summary
Verification