-
Notifications
You must be signed in to change notification settings - Fork 327
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-react,clerk-js,shared): Dynamically update props based on … #2515
feat(clerk-react,clerk-js,shared): Dynamically update props based on … #2515
Conversation
…deep equality This change was made in an effort to support dynamic values for appearance, localization as modifying this values usually happens during dev where a fast HMR iteration cycle is required. However, we'd also like to support dynamic values for props like redirectUrl, where the value can be calculated based on data available during runtime, even after the Clerk components mount (eg, based on the results of a fetch request). In order to avoid extra renders, we use the pre-existing dequal utility to make sure that expensive calculations are avoided.
🦋 Changeset detectedLatest commit: b191313 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
@@ -16,3 +16,5 @@ const useDeepEqualMemoize = <T>(value: T) => { | |||
export const useDeepEqualMemo: UseDeepEqualMemo = (factory, dependencyArray) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was moved from clerk-js
to shared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 👑
61cebda
to
8cc2a5c
Compare
React `children` can hold circular references with other `children` arrays and this crashes the deepEqual mechanism The customPages implementation requires the prop references to always change so there is no need to compare these on every prop update
…deep equality
This change was made in an effort to support dynamic values for appearance, localization as modifying this values usually happens during dev where a fast HMR iteration cycle is required. However, we'd also like to support dynamic values for props like redirectUrl, where the value can be calculated based on data available during runtime, even after the Clerk components mount (eg, based on the results of a fetch request).
In order to avoid extra renders, we use the pre-existing dequal utility to make sure that expensive calculations are avoided.
Description
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore