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

fix(shared): Automatic hook revalidation v4 #3091

Open
wants to merge 6 commits into
base: release/v4
Choose a base branch
from

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Apr 2, 2024

Description

Before

Screen.Recording.2024-04-04.at.1.52.23.PM.mov

After

Screen.Recording.2024-04-04.at.1.46.27.PM.mov

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:

…ources based on events

Three new events were added to `eventBus` in order to describe the action that was taken and broadcast it to subscribers.

This ensures that specific clerk-js methods can broadcast an event and our hooks can listen to that event and in this case revalidate the cache.

This is extremely useful of situations where our UI components are used in conjunction with custom implementations. For example, let's say that an application is using the Organization Profile and CreateOrganization components, but it has a custom implementation of OrganizationSwitcher. Until now there was no way to notify the custom switcher to refetch data when an organization was created via the component.
@panteliselef panteliselef self-assigned this Apr 2, 2024
Copy link

changeset-bot bot commented Apr 2, 2024

🦋 Changeset detected

Latest commit: f033e0d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/clerk-react Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
gatsby-plugin-clerk 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants