feat(shared): add internal directory sync react-query hooks - #9591
feat(shared): add internal directory sync react-query hooks#9591kalafut wants to merge 4 commits into
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9525da1 to
2291ba0
Compare
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
@clerk/sharedCurrent version: 4.31.0 Subpath
|
2291ba0 to
8db31e5
Compare
8db31e5 to
875352a
Compare
875352a to
f801038
Compare
f801038 to
3d18031
Compare
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
3d18031 to
4adb710
Compare
NicolasLopes7
left a comment
There was a problem hiding this comment.
Got fable looking/running this and had a couple of inline-comments. Other than that I'd suggest tests for the hooks to cover the regressions, otherwise LGTM
4adb710 to
247b096
Compare
247b096 to
3342ab9
Compare
3342ab9 to
6b53c5d
Compare
__internal_useOrganizationDirectorySync and __internal_useOrganizationDirectorySyncUsers; the users hook polls continuously while enabled so the test step can double as a recent-activity feed.
…Sync resource Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U54pszNFtqsBNpQhXaGvaa
Also add tests
6b53c5d to
c40e012
Compare
| * Never carries the bearer token — that only exists on the resources resolved by | ||
| * `createDirectorySync` and `rotateDirectorySyncToken`. |
| const DEFAULT_POLL_INTERVAL_MS = 2_000; | ||
|
|
||
| export type UseOrganizationDirectorySyncUsersParams = { | ||
| /** The directory to list users for, e.g. `data` from `useOrganizationDirectorySync`. Dormant while nullish. */ |
There was a problem hiding this comment.
What does "Dormant while nullish." mean?
| * deprovisions keep appearing) until `stopPolling` is called — callers | ||
| * should stop on unmount of the view that armed it. |
There was a problem hiding this comment.
this sounds like we should encapsulate the start and stop polling into an effect that returns a cleanup callback function.
|
|
||
| /** | ||
| * The users provisioned into an enterprise connection's Directory Sync | ||
| * directory, most recently touched first. Polls continuously while armed via |
| const isPolling = queryEnabled && shouldPoll; | ||
|
|
||
| return { | ||
| // Dormant means dormant: never surface cached rows while the query cannot run. |
| * | ||
| * @internal | ||
| */ | ||
| function useOrganizationDirectorySyncUsers( |
There was a problem hiding this comment.
will this internal hook always be used with polling?
| // Polling is armed for a specific connection and derived, not reset in an effect: a child | ||
| // effect arming it in the same commit the connection arrives would otherwise be cancelled. |
Description
Part 2 of 4 of the self-serve Directory Sync stack. Stacked on
jim/dir-sync-1-resource. This change depends on the first PR and the stack will be squashed on merge.Adds the internal react-query hooks
__internal_useOrganizationDirectorySyncand__internal_useOrganizationDirectorySyncUsers. Mutations go through the loadedDirectorySyncresource, so they resolveundefineduntil the directory has loaded. The users hook takes thedirectoryresource itself and stays dormant while it is nullish; it polls while armed viastartPolling, so the wizard's test step doubles as a recent-activity feed.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
✎