Skip to content

chore(clerk-js): Tidy up layout and logic of PlanDetails drawer #5928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aeliox
Copy link
Contributor

@aeliox aeliox commented May 14, 2025

Description

Update PlanDetails to behave similarly to the plan cards used in the PricingTable.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented May 14, 2025

🦋 Changeset detected

Latest commit: c5f8ddb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 10:23pm

Comment on lines +54 to +56
useEffect(() => {
setPlanPeriod(_planPeriod);
}, [_planPeriod]);
Copy link
Member

Choose a reason for hiding this comment

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

Let's not sync state like that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to think more about this. We want the PlanDetails to manage its own internal planPeriod state, defaulting to the planPeriod that it's passed as a prop, and updating anytime the prop updates.


const portalRoot = getClosestProfileScrollBox(mode, event);

if (subscription && subscription.planPeriod === planPeriod && !subscription.canceledAt) {
clerk.__internal_openPlanDetails({
plan,
planPeriod,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this information be picked up from the plan that we are already passing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think was a bug / oversight, because without this, opening the PlanDetails drawer from the SubscriptionsList would default the planPeriod to month even when the subscription being referenced had an annual planPeriod.

Copy link
Member

Choose a reason for hiding this comment

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

I think we need to re-think some of this stuff, here a PlanDetails can be used to display both a plan that you are not have not subscribed but also a plan that you have subscribed on. For the plans that you have subscribed on, the subscription itself should tell the UI if it for a month or annual, right ? It should not be accepted as a prop.

I think the abstraction is starting to break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants