Skip to content

chore(clerk-js): Address leftover commerce TODOs #6183

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 1 commit into
base: main
Choose a base branch
from

Conversation

aeliox
Copy link
Contributor

@aeliox aeliox commented Jun 23, 2025

Description

Address leftover TODOs from Commerce launch.

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:

Summary by CodeRabbit

  • Performance Improvements

    • Converted several profile and billing-related pages to load only when needed, which can improve initial load times for user and organization profile sections.
  • Chores

    • Updated bundle size limits for various profile and billing pages.
    • Added a metadata file for tracking a patch update.
    • Removed outdated TODO comments from several components.

Copy link

vercel bot commented Jun 23, 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 Jun 23, 2025 6:29pm

Copy link

changeset-bot bot commented Jun 23, 2025

🦋 Changeset detected

Latest commit: 10bb031

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

@@ -101,7 +100,6 @@ export const AddEmailForm = () => {
padding: t.space.$4,
})}
>
{/* TODO(@COMMERCE): How does ths operate for orgs ? */}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This flow works for orgs by grabbing the current member's email (once added) and associating that with the payer record

@@ -250,7 +250,7 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
const { setupIntent, error } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: '', // TODO(@COMMERCE): need to figure this out
return_url: '',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We prevent payment methods that require a redirect, so this param is never used (though required)

Copy link
Member

Choose a reason for hiding this comment

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

Are we plan to support them in the future ? Are we planning to communicate that they will need to bump sdk versions in order to use it at that point ?

Maybe at least we so something like, unless '' has the same effect.

Suggested change
return_url: '',
return_url: '',
Suggested change
return_url: '',
return_url: window.location.href,

Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

📝 Walkthrough

Walkthrough

This change updates the clerk-js package by removing several leftover TODO comments across multiple source files, specifically in checkout, payment source, and profile-related components. It adjusts the bundle size limits for various JavaScript bundles in the bundlewatch.config.json file, reducing some limits and adding new entries for additional bundles. Additionally, the imports for certain profile-related pages are converted from static imports to lazy-loaded dynamic imports using React's lazy function, affecting both organization and user profile route components. No functional or behavioral changes to exported entities are introduced.

Suggested labels

clerk-js

Suggested reviewers

  • wobsoriano
  • dstaley

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/silent-zebras-refuse.md (1)

5-5: Consider using "to-dos" for consistency with style guides.

While "TODOs" is commonly used in technical contexts, "to-dos" with hyphens is the grammatically preferred form according to style guides.

-Cleanup leftover Commerce-launch TODOs
+Cleanup leftover Commerce-launch to-dos
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62ca696 and 10bb031.

📒 Files selected for processing (6)
  • .changeset/silent-zebras-refuse.md (1 hunks)
  • packages/clerk-js/bundlewatch.config.json (1 hunks)
  • packages/clerk-js/src/ui/components/Checkout/parts.tsx (0 hunks)
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/clerk-js/src/ui/components/Checkout/parts.tsx
🧰 Additional context used
📓 Path-based instructions (4)
`**/*.{js,ts,tsx,jsx}`: All code must pass ESLint checks with the project's configuration. Use Prettier for consistent code formatting.

**/*.{js,ts,tsx,jsx}: All code must pass ESLint checks with the project's configuration.
Use Prettier for consistent code formatting.

  • packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx
  • packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx
`**/*.{ts,tsx}`: Maintain comprehensive JSDoc comments for public APIs.

**/*.{ts,tsx}: Maintain comprehensive JSDoc comments for public APIs.

  • packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx
  • packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx
`packages/**`: All publishable packages under the @clerk namespace must be located in the packages/ directory.

packages/**: All publishable packages under the @clerk namespace must be located in the packages/ directory.

  • packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx
  • packages/clerk-js/bundlewatch.config.json
  • packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx
`**/*.{jsx,tsx}`: Always use functional components with hooks instead of class components. Follow PascalCase naming for components; the filename and component name should match. Li...

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components.
Follow PascalCase naming for components; the filename and component name should match.
Limit component size to 150-200 lines; extract logic into custom hooks.
Export components as named exports for better tree-shaking.
One component per file with matching filename and component name.
Co-locate related files (component, test, stories) in the same directory.

  • packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx
  • packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx
  • packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx
🧠 Learnings (1)
.changeset/silent-zebras-refuse.md (1)
Learnt from: dstaley
PR: clerk/javascript#6116
File: .changeset/tangy-garlics-say.md:1-2
Timestamp: 2025-06-13T16:09:53.061Z
Learning: In the Clerk JavaScript repository, contributors create intentionally empty changeset files (containing only the YAML delimiters) when a PR touches only non-published parts of the codebase (e.g., sandbox assets). This signals that no package release is required, so such changesets should not be flagged as missing content.
🪛 LanguageTool
.changeset/silent-zebras-refuse.md

[grammar] ~5-~5: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ...h --- Cleanup leftover Commerce-launch TODOs

(TO_DO_HYPHEN)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
packages/clerk-js/src/ui/components/PaymentSources/AddPaymentSource.tsx (2)

252-254: Verify that empty return_url is acceptable for Stripe setup.

The TODO comment removal left an empty string for return_url. While Stripe allows this for redirect: 'if_required', please ensure this meets your integration requirements.


296-298: Apple Pay managementURL implementation looks appropriate.

Using displayConfig.homeUrl for the Apple Pay recurring payment management URL is a reasonable default implementation after removing the TODO comment.

packages/clerk-js/bundlewatch.config.json (1)

12-12: Bundle size adjustments align well with lazy loading implementation.

The reduced limits for main profile bundles and new entries for lazy-loaded pages reflect the code splitting changes appropriately. This should improve initial bundle loading performance.

Also applies to: 18-18, 26-31

packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfileRoutes.tsx (1)

22-38: Well-implemented lazy loading with proper code splitting.

The conversion to lazy-loaded components follows React best practices with:

  • Correct use of React.lazy()
  • Webpack chunk names for predictable bundle naming
  • Existing Suspense wrappers maintained
  • Clean import structure

This should improve initial page load performance by deferring these components until needed.

packages/clerk-js/src/ui/components/UserProfile/UserProfileRoutes.tsx (1)

22-38: Consistent lazy loading implementation with shared components.

The lazy loading implementation matches the organization profile pattern and correctly handles shared components (StatementPage and PaymentAttemptPage) imported from separate directories. This promotes code reuse while maintaining performance benefits.

Copy link

pkg-pr-new bot commented Jun 23, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6183

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6183

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6183

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6183

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6183

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6183

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6183

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6183

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6183

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6183

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6183

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6183

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6183

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6183

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6183

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6183

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6183

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6183

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6183

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6183

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6183

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6183

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6183

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6183

commit: 10bb031

@aeliox aeliox requested a review from panteliselef June 25, 2025 15:53
Comment on lines +30 to +31
{ "path": "./dist/statement-page*.js", "maxSize": "1.0KB" },
{ "path": "./dist/payment-attempt-page*.js", "maxSize": "3.0KB" },
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason we have seperate chunks between UP and OP for plans, but not for statements and PAs ?

@@ -250,7 +250,7 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
const { setupIntent, error } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: '', // TODO(@COMMERCE): need to figure this out
return_url: '',
Copy link
Member

Choose a reason for hiding this comment

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

Are we plan to support them in the future ? Are we planning to communicate that they will need to bump sdk versions in order to use it at that point ?

Maybe at least we so something like, unless '' has the same effect.

Suggested change
return_url: '',
return_url: '',
Suggested change
return_url: '',
return_url: window.location.href,

@@ -294,7 +294,7 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
? {
recurringPaymentRequest: {
paymentDescription: `${t(localizationKeys(checkout.planPeriod === 'month' ? 'commerce.paymentSource.applePayDescription.monthly' : 'commerce.paymentSource.applePayDescription.annual'))}`,
managementURL: displayConfig.homeUrl, // TODO(@COMMERCE): is this the right URL?
managementURL: displayConfig.homeUrl,
Copy link
Member

Choose a reason for hiding this comment

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

this will probably land them to the index page of their website or / of AP.

Would it be better to do
displayConfig.organizationProfileUrl for orgs and then displayConfig.userProfileUrl for users ?

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