fix: reference error, when using useQuery #1218
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had an reference error, when using useQuery() in alpha.13. currentOptions was referenced before being declared. (Please see my traceback.) In my pull request, I move the declaration of currentOptions to the beginning of the relevant function.
Uncaught (in promise) ReferenceError: can't access lexical declaration 'currentOptions' before initialization
updateRestartFn useQuery.ts:358
restart useQuery.ts:373
useQueryImpl useQuery.ts:381
callWithErrorHandling runtime-core.esm-bundler.js:155
callWithAsyncErrorHandling runtime-core.esm-bundler.js:164
job runtime-core.esm-bundler.js:2034
doWatch runtime-core.esm-bundler.js:2081
watch runtime-core.esm-bundler.js:1938
useQueryImpl useQuery.ts:379
useQuery useQuery.ts:129
setup index.vue:84
callWithErrorHandling runtime-core.esm-bundler.js:155
setupStatefulComponent runtime-core.esm-bundler.js:7161
setupComponent runtime-core.esm-bundler.js:7117
mountComponent runtime-core.esm-bundler.js:5115
processComponent runtime-core.esm-bundler.js:5090
patch runtime-core.esm-bundler.js:4684
mountChildren runtime-core.esm-bundler.js:4880
mountElement runtime-core.esm-bundler.js:4801
processElement runtime-core.esm-bundler.js:4773
patch runtime-core.esm-bundler.js:4681
mountSuspense runtime-core.esm-bundler.js:1484
process runtime-core.esm-bundler.js:1460
patch runtime-core.esm-bundler.js:4690
mountChildren runtime-core.esm-bundler.js:4880
processFragment runtime-core.esm-bundler.js:5049
patch runtime-core.esm-bundler.js:4677
componentEffect runtime-core.esm-bundler.js:5227
reactiveEffect reactivity.esm-bundler.js:42
effect reactivity.esm-bundler.js:17
setupRenderEffect runtime-core.esm-bundler.js:5173
mountComponent runtime-core.esm-bundler.js:5132
processComponent runtime-core.esm-bundler.js:5090
patch runtime-core.esm-bundler.js:4684
componentEffect runtime-core.esm-bundler.js:5227
reactiveEffect reactivity.esm-bundler.js:42
effect reactivity.esm-bundler.js:17
setupRenderEffect runtime-core.esm-bundler.js:5173
mountComponent runtime-core.esm-bundler.js:5132
processComponent runtime-core.esm-bundler.js:5090
patch runtime-core.esm-bundler.js:4684
render2 runtime-core.esm-bundler.js:5810
mount runtime-core.esm-bundler.js:4085
node_modules chunk-6TA7PGT5.js:8194
viteSSR2 entry-client.js:47
async* main.ts:16
useQuery.ts:358:9