fix(platform): loading spinner showing on all plans by scoping loading state to selected plan #25292
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.
Fixes #25290
Problem
When users clicked on a plan card in the Cal.com Platform pricing UI, the loading spinner would appear on ALL plan cards simultaneously instead of just the selected one. This gave a confusing UX impression that all plans were being processed at the same time.
Solution
Track the currently loading plan using a
loadingPlanstate variable that stores which plan the user clicked on, rather than relying solely on the pending state from the mutation hook.Changes
loadingPlanstate to track which specific plan is loadingloadingPlanwhen a plan subscription is initiatedloadingPlanon error to ensure UI returns to normal stateisLoadingprop condition to check if the current plan matches theloadingPlanbefore showing the spinnerThis ensures that only the plan card the user clicked on displays the loading indicator, while other plans remain in their normal state.
What does this PR do?
Visual Demo (For contributors especially)
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
screen-capture.1.webm
Show screen recordings of the issue or feature.
Demonstrate how to reproduce the issue, the behavior before and after the change.
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist
Summary by cubic
Scopes the Platform pricing loading spinner to only the selected plan, so clicking a plan shows a spinner on that card only. Fixes CAL-6794 by meeting the requirement to display the loading state for the chosen plan.
Written for commit 3047afc. Summary will update automatically on new commits.