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 |
| method: 'GET', | ||
| search: convertPageToOffset(getRolesParams) as any, | ||
| }).then(res => { | ||
| return await BaseResource._fetch( |
There was a problem hiding this comment.
🙃 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.
❓ @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 testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore