-
Notifications
You must be signed in to change notification settings - Fork 253
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
fix(clerk-js): Emit session when permissions or role of the active memberships change #2073
Conversation
🦋 Changeset detectedLatest commit: e1c5144 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
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.
💯
method: 'GET', | ||
search: convertPageToOffset(getRolesParams) as any, | ||
}).then(res => { | ||
return await BaseResource._fetch( |
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.
🙃 i think there is no need to return await
in an async function. this PR didn't change the existing codebase but i think we should jest return the promise. This is a suggestion for the future.
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.
❓ @panteliselef Why do we need to pass forceUpdateClient
? Isn't this change gonna force the re-rendering of all the Clerk components? Are we sure we want to use the forceUpdateClient to all those places?
My understanding is that these changes will only affect the rerender of components if the conditions inside Even if |
Description
This PR allows for clerk-js to detect when the role or permissions of the active organization memberships of the user has changed and emit them for subscribers (in this case clerk-react is what we are interested in).
Before
not.working.mov
After
works.mov
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