feat: use plan change estimation in billing flow#3031
feat: use plan change estimation in billing flow#3031HarshMN2345 wants to merge 5 commits intomainfrom
Conversation
Greptile SummaryThis PR lifts the plan-change estimation call out of
Confidence Score: 3/5Safe to merge after fixing the stale compliance display — no data loss risk, but users switching between downgrade targets see compliance alerts for the wrong plan while the real check is in flight. The planChangeEstimate variable is never cleared at the start of loadPlanChangeEstimate, so compliance alerts in OrganizationUsageLimits keep showing the previous plan's data while the new estimate loads. The loading indicator never appears during plan switches because targetPlanLimits remains truthy with stale data. src/routes/(console)/organization-[organization]/change-plan/+page.svelte — loadPlanChangeEstimate should reset planChangeEstimate to null before each new request. Important Files Changed
Reviews (4): Last reviewed commit: "fix: block unsafe downgrades on estimate..." | Re-trigger Greptile |
| isLoadingPlanEstimate = true; | ||
| planEstimateError = null; | ||
|
|
||
| try { |
There was a problem hiding this comment.
When the user switches between downgrade targets,
planChangeEstimate is never cleared before the new request fires. Because targetPlanLimits in OrganizationUsageLimits is derived from planChangeEstimate, the compliance alerts continue to show the previously selected plan's data while the new request is in flight. The {:else if loading} "Checking plan limits" indicator only renders when targetPlanLimits is null — but since the old value is still there, that indicator is never shown during plan switches, only during the very first load. Users changing plans see compliance alerts for the wrong plan while the real check is running.
| isLoadingPlanEstimate = true; | |
| planEstimateError = null; | |
| try { | |
| isLoadingPlanEstimate = true; | |
| planEstimateError = null; | |
| planChangeEstimate = null; | |
| try { |
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)