Skip to content

Commit

Permalink
feat(clerk-js): Allow persisting Clerk client options (#4662)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstaley authored Nov 27, 2024
1 parent 5b7d96f commit 23a9160
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changeset/hungry-rivers-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 3 additions & 0 deletions packages/clerk-js/sandbox/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

const AVAILABLE_COMPONENTS = /** @type {const} */ ([
'clerk', // While not a component, we want to support passing options to the Clerk class.
'signIn',
'signUp',
'userButton',
Expand Down Expand Up @@ -80,6 +81,7 @@ function buildComponentControls(component) {
* @type {Record<typeof AVAILABLE_COMPONENTS[number], ComponentPropsControl>}
*/
const componentControls = {
clerk: buildComponentControls('clerk'),
signIn: buildComponentControls('signIn'),
signUp: buildComponentControls('signUp'),
userButton: buildComponentControls('userButton'),
Expand Down Expand Up @@ -176,6 +178,7 @@ function addCurrentRouteIndicator(currentRoute) {
const renderCurrentRoute = routes[route];
addCurrentRouteIndicator(route);
await Clerk.load({
...(componentControls.clerk.getProps() ?? {}),
signInUrl: '/sign-in',
signUpUrl: '/sign-up',
});
Expand Down

0 comments on commit 23a9160

Please sign in to comment.