You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All variables passed to useAsyncGql are watched by default. There is no way to override the watch property of the underlying useAsyncData, at least all variables will be watched.
exportfunctionuseAsyncGql(...args: any[]){consttoReactive=(v: any)=>v&&isRef(v) ? v : reactive(v)constoptions=(typeofargs?.[0]!=='string'&&'options'inargs?.[0] ? args[0].options : args[2])??{}constoperation=(typeofargs?.[0]!=='string'&&'operation'inargs?.[0] ? args[0].operation : args[0])??undefinedconstvariables=(typeofargs?.[0]!=='string'&&'variables'inargs?.[0] ? toReactive(args[0].variables) : args[1]&&toReactive(args[1]))??undefinedif(variables){options.watch=options.watch||[]// ⬇️ this line here causes the issueoptions.watch.push(variables)}constkey=`gql:data:${hash({ operation, variables })}`returnuseAsyncData(key,()=>useGql()(operation,unref(variables)),options)}
As you can see here, useAsyncData requires every watch source to be explicitely registered.
I understand that one wants to keep backwards compatibility and not break existing implementations, but would it be possible to - for example - provide a flag autowatch=false (or just to use the value of options.watch) to disable the by default registration?
Expected behaviour
The variables should not be watched by default. At least, there should be a flag to turn off the automatic registration.
Reproduction
No response
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Environment
Any
Describe the bug
All variables passed to
useAsyncGql
are watched by default. There is no way to override thewatch
property of the underlyinguseAsyncData
, at least allvariables
will be watched.src/runtime/composables/index.ts#L332
As you can see here,
useAsyncData
requires every watch source to be explicitely registered.I understand that one wants to keep backwards compatibility and not break existing implementations, but would it be possible to - for example - provide a flag
autowatch=false
(or just to use the value ofoptions.watch
) to disable the by default registration?Expected behaviour
The variables should not be watched by default. At least, there should be a flag to turn off the automatic registration.
Reproduction
No response
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: