Skip to content
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

feat(clerk-js): Send FAPI version through URLSearchParams #4457

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

Conversation

jacekradko
Copy link
Member

Description

We need to pass the FAPI version as a query param

Checklist

  • npm test runs as expected.
  • npm run 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 Nov 1, 2024

🦋 Changeset detected

Latest commit: 93fe983

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 Minor
@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

@jacekradko jacekradko changed the title feat(clerk-js): send FAPI version through URLSearchParams feat(clerk-js): Send FAPI version through URLSearchParams Nov 1, 2024
@jacekradko jacekradko marked this pull request as ready for review November 1, 2024 20:32
@@ -91,6 +92,9 @@ export function createFapiClient(clerkInstance: Clerk): FapiClient {
const searchParams = new URLSearchParams(search as any);
// the above will parse {key: ['val1','val2']} as key: 'val1,val2' and we need to recreate the array bellow

// Append supported FAPI version to the query string
searchParams.append('__clerk_api_version', SUPPORTED_FAPI_VERSION);
Copy link
Member

Choose a reason for hiding this comment

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

The one for clerk js version only has one underscore as a prefix, is there a reason we break out of the existing pattern ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great question. Following the docs here: https://clerk.com/docs/backend-requests/versioning/overview#choosing-an-api-version . I can confirm with the API team that the double underscore is expected

@@ -37,3 +37,6 @@ export const SIGN_UP_MODES: Record<string, SignUpModes> = {
PUBLIC: 'public',
RESTRICTED: 'restricted',
};

// This is the currently support version of the Frontend API
export const SUPPORTED_FAPI_VERSION = '2024-10-01';
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about FAPI versioning and keeping types in sync. The types package version and which FAPI version they represent.

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