fix(billing): stop throwing when plans page has no resolved org - #2904
Merged
riderx merged 1 commit intoAug 7, 2026
Merged
Conversation
The plans page threw `new Error('Cannot get current org id')` from
loadData() when no organization could be resolved, escaping as an
unhandled rejection and leaving users on a broken billing page with no
recovery path.
- loadData() now bails out gracefully instead of throwing: it surfaces
the existing cannot-view-plans dialog and routes to /apps (the same
path the no-permission case already uses).
- The un-awaited loadData(true) call in the route watchEffect now has a
catch so a load failure can never escape as an unhandled rejection.
- setCurrentOrganization() no longer silently assigns undefined when the
id isn't in the user's org list (what an ?oid= for a non-member org
produces); it logs loudly and keeps the current org untouched.
Generated-By: PostHog Code
Task-Id: 2aeed371-1257-4461-91ca-3fe9db990e9a
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
|
riderx
marked this pull request as ready for review
August 7, 2026 16:16
riderx
deleted the
posthog-self-driving/fixbilling-stop-throwing-when-plans-c9b44e
branch
August 7, 2026 16:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
console.capgo.app/settings/organization/plans) and got a broken render with no dialog and no redirect — an unhandled exception, not a caught error.loadData()inPlans.vuethrewnew Error('Cannot get current org id')whenevercurrentOrganizationwas still undefined. Two paths reach it with no org set, andsetCurrentOrganizationsilently assignedundefinedwhen handed an id not in the user's org list — exactly what an?oid=pointing at an org you aren't a member of produces.Changes:
loadData()now bails out gracefully — surfaces the existingcannot-view-plansdialog and routes to/apps, the same recovery the no-permission path already uses (guarded so the watchers don't stack dialogs).loadData(true)call in the routewatchEffectnow has acatch, so a load failure can never surface as an unhandled rejection.setCurrentOrganizationno longer silently clearscurrentOrganizationtoundefinedon an unknown id — itconsole.errors and keeps the current org untouched.Note
#2900 also edits
Plans.vue(dark-mode loader / checkout popup). Different intent, no logical overlap — expect only a textual conflict.Test plan
/settings/organization/plans?oid=<an-org-you-are-not-a-member-of>: previously threw an uncaught error and rendered a broken page; now the current org is preserved (the id is rejected loudly in the console) and the page renders normally.cannot-view-plansdialog and redirects to/appsinstead of crashing.Screenshots
Checklist
bun run lint:backend && bun run lint.accordingly.
my tests
Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.