Skip to content

chore(clerk-js): Refactor fapiClient to not rely on Clerk instance - #4947

Merged
brkalow merged 6 commits into
mainfrom
brk.chore/fapiClient-no-clerk-instance
Jan 21, 2025
Merged

brkalow merged 6 commits into
mainfrom
brk.chore/fapiClient-no-clerk-instance

Conversation

@brkalow

@brkalow brkalow commented Jan 20, 2025

Copy link
Copy Markdown
Member

Description

Refactors createFapiClient() to not rely on an instance of Clerk(). Instead, accept an explicit options object. This should make this method more portable in the future. If we want to, for example, expose a standalone FAPI client.

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:

@brkalow
brkalow requested a review from a team January 20, 2025 18:15
@changeset-bot

changeset-bot Bot commented Jan 20, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24d98ef

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

@vercel

vercel Bot commented Jan 20, 2025 •

Copy link
Copy Markdown

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 Jan 20, 2025 10:43pm

Comment on lines +7 to +11
globals: {
__PKG_NAME__: '@clerk/clerk-js',
__PKG_VERSION__: 'test',
BUILD_ENABLE_NEW_COMPONENTS: '',
},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It felt more expected to define the global variables here. Moved and added values for the __PKG_ vars.

Comment thread packages/clerk-js/src/core/fapiClient.ts Outdated
globals: {
__PKG_NAME__: '@clerk/clerk-js',
__PKG_VERSION__: 'test',
BUILD_ENABLE_NEW_COMPONENTS: '',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess since you removed that code in another PR we can remove that global?


if (clerkInstance.instanceType === 'development' && clerkInstance.isSatellite) {
searchParams.append('__domain', clerkInstance.domain);
// if (clerkInstance.instanceType === 'development' && clerkInstance.isSatellite) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left-over code

@brkalow
brkalow merged commit 9da41ce into main Jan 21, 2025
@brkalow
brkalow deleted the brk.chore/fapiClient-no-clerk-instance branch January 21, 2025 09:55
@LekoArts LekoArts mentioned this pull request Jan 21, 2025
9 tasks
brkalow pushed a commit that referenced this pull request Jan 21, 2025

@nikosdouvlis nikosdouvlis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👀

This branch was successfully deployed

1 active deployment
Preview — 24d98efe Deployed Jan 20, 2025 by vercel[bot]
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.

4 participants