chore: use logical or assignment (#30992)

This commit is contained in:
Alex Liu 2025-02-15 03:00:00 +08:00 committed by Daniel Roe
parent 62cb4a6ec1
commit 72159e0808
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
3 changed files with 3 additions and 3 deletions

View File

@ -523,7 +523,7 @@ export function tryUseNuxtApp (id?: string): NuxtApp | null {
nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt
} }
nuxtAppInstance = nuxtAppInstance || getNuxtAppCtx(id).tryUse() nuxtAppInstance ||= getNuxtAppCtx(id).tryUse()
return nuxtAppInstance || null return nuxtAppInstance || null
} }

View File

@ -52,7 +52,7 @@ function pageToClientOnly<T extends ComponentOptions> (component: T) {
if (isPromise(setupState)) { if (isPromise(setupState)) {
return Promise.resolve(setupState).then((setupState: any) => { return Promise.resolve(setupState).then((setupState: any) => {
if (typeof setupState !== 'function') { if (typeof setupState !== 'function') {
setupState = setupState || {} setupState ||= {}
setupState.mounted$ = mounted$ setupState.mounted$ = mounted$
return setupState return setupState
} }

View File

@ -68,7 +68,7 @@ export const ComposableKeysPlugin = (options: ComposableKeysOptions) => createUn
const name = node.callee.name const name = node.callee.name
if (!name || !keyedFunctions.has(name) || node.arguments.length >= maxLength) { return } if (!name || !keyedFunctions.has(name) || node.arguments.length >= maxLength) { return }
imports = imports || detectImportNames(script, composableMeta) imports ||= detectImportNames(script, composableMeta)
if (imports.has(name)) { return } if (imports.has(name)) { return }
const meta = composableMeta[name] const meta = composableMeta[name]