Skip to content

Commit

Permalink
fix(vite, webpack): handle auto keys for composables without args (nu…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Sep 19, 2022
1 parent f536bf5 commit 42cf48e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/plugins/composable-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptio

switch (name) {
case 'useState':
if (node.arguments.length >= 2 || stringTypes.includes(node.arguments[0].type)) { return }
if (node.arguments.length >= 2 || stringTypes.includes(node.arguments[0]?.type)) { return }
break

case 'useFetch':
Expand All @@ -55,7 +55,7 @@ export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptio

case 'useAsyncData':
case 'useLazyAsyncData':
if (node.arguments.length >= 3 || stringTypes.includes(node.arguments[0].type) || stringTypes.includes(node.arguments[node.arguments.length - 1].type)) { return }
if (node.arguments.length >= 3 || stringTypes.includes(node.arguments[0]?.type) || stringTypes.includes(node.arguments[node.arguments.length - 1]?.type)) { return }
break
}

Expand Down

0 comments on commit 42cf48e

Please sign in to comment.