Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 470
chore(shared): Improve cache key creation#7217
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
3e5b34e9e2f4e72f08c8bf981de3ba0b3e73b82d780c9f8cf58f960538da12d6bc27c5File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/shared': patch | ||
| --- | ||
| Update how cache keys are created in SWR/RQ hooks. |
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * @internal | ||
| */ | ||
| export function createCacheKeys< | ||
| Params, | ||
| StableKey extends string, | ||
| T extends Record<string, unknown> = Record<string, unknown>, | ||
| U extends Record<string, unknown> | undefined = undefined, | ||
| >(params: { | ||
| stablePrefix: StableKey; | ||
| authenticated: boolean; | ||
| tracked: T; | ||
| untracked: U extends { args: Params } ? U : never; | ||
| }) { | ||
| return { | ||
| queryKey: [params.stablePrefix, params.authenticated, params.tracked, params.untracked] as const, | ||
| invalidationKey: [params.stablePrefix, params.authenticated, params.tracked] as const, | ||
| stableKey: params.stablePrefix, | ||
| authenticated: params.authenticated, | ||
| }; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.