Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
add workaround for autogenerated key
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 7, 2022
1 parent 5964216 commit 4c42bc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/nuxt/src/app/composables/asyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ export function useLazyAsyncData<
const autoKey = typeof args[args.length - 1] === 'string' ? args.pop() : undefined
if (typeof args[0] !== 'string') { args.unshift(autoKey) }
const [key, handler, options] = args as [string, (ctx?: NuxtApp) => Promise<DataT>, AsyncDataOptions<DataT, Transform, PickKeys>]
return useAsyncData(key, handler, { ...options, lazy: true })
// @ts-ignore
return useAsyncData(key, handler, { ...options, lazy: true }, null)
}

export function refreshNuxtData (keys?: string | string[]): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/plugins/composable-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptio
}), {
enter (node: CallExpression) {
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier') { return }
if (keyedFunctions.includes(node.callee.name)) {
if (keyedFunctions.includes(node.callee.name) && node.arguments.length < 4) {
const end = (node as any).end
s.appendLeft(
codeIndex + end - 1,
Expand Down

0 comments on commit 4c42bc6

Please sign in to comment.