-
Notifications
You must be signed in to change notification settings - Fork 366
chore(vue,nuxt): Make initialState
prop public and bump dependencies
#6132
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
Changes from all commits
0514fb3
0a8f5ea
c540338
be0fde0
4042360
c068924
feecc78
fa41fb8
b1c10b2
bd3dff6
0ba011b
25fa70a
a0fd8fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@clerk/nuxt": patch | ||
"@clerk/vue": patch | ||
--- | ||
|
||
Make `initialState` prop public and bump `@nuxt/kit` to 3.17.5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { inBrowser } from '@clerk/shared/browser'; | ||
import { deriveState } from '@clerk/shared/deriveState'; | ||
import { loadClerkJsScript, type LoadClerkJsScriptOptions } from '@clerk/shared/loadClerkJsScript'; | ||
import type { Clerk, ClientResource, MultiDomainAndOrProxy, Resources, Without } from '@clerk/types'; | ||
import type { Clerk, ClientResource, InitialState, MultiDomainAndOrProxy, Resources, Without } from '@clerk/types'; | ||
import type { Plugin } from 'vue'; | ||
import { computed, ref, shallowRef, triggerRef } from 'vue'; | ||
|
||
import { ClerkInjectionKey } from './keys'; | ||
|
||
export type PluginOptions = Without<LoadClerkJsScriptOptions, 'domain' | 'proxyUrl'> & MultiDomainAndOrProxy; | ||
export type PluginOptions = Without<LoadClerkJsScriptOptions, 'domain' | 'proxyUrl'> & | ||
MultiDomainAndOrProxy & { | ||
initialState?: InitialState; | ||
}; | ||
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion
const options = {
...pluginOptions,
sdkMetadata: pluginOptions.sdkMetadata || SDK_METADATA,
} as LoadClerkJsScriptOptions;
A minimal, type-safe guard: -const options = {
- ...pluginOptions,
- sdkMetadata: pluginOptions.sdkMetadata || SDK_METADATA,
-} as LoadClerkJsScriptOptions;
+const { initialState, ...loadOptions } = pluginOptions;
+const options: LoadClerkJsScriptOptions = {
+ ...loadOptions,
+ sdkMetadata: loadOptions.sdkMetadata || SDK_METADATA,
+}; Keeps runtime payload clean and removes the need for the 🤖 Prompt for AI Agents
|
||
|
||
const SDK_METADATA = { | ||
name: PACKAGE_NAME, | ||
|
@@ -35,7 +38,6 @@ const SDK_METADATA = { | |
*/ | ||
export const clerkPlugin: Plugin<[PluginOptions]> = { | ||
install(app, pluginOptions) { | ||
// @ts-expect-error: Internal property for SSR frameworks like Nuxt | ||
const { initialState } = pluginOptions; | ||
|
||
const loaded = shallowRef(false); | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
SessionAuthObject
is a new type introduced in machine authsee token types