Skip to content
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

fix: reference error, when using useQuery #1218

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

TimoStolz
Copy link
Contributor

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

(ReferenceError: can't access lexical declaration
'currentOptions' before initialization, occure in
useQuery.ts:358)
Copy link

@maartenvn maartenvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to fix the issue! Maybe some tests should be added in the future, to prevent these kind of bugs, since they are so easy to overlook?

@Akryum Akryum changed the title fix reference error, when using useQuery fix: reference error, when using useQuery Jul 19, 2021
@Akryum Akryum merged commit 08b6b0e into vuejs:v4 Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants