@@ -155,7 +155,7 @@ export function useQuery<TData = unknown, TVariables extends OperationVariables
155155 const networkStatus = ref < NetworkStatus > ( )
156156 const error = ref < ErrorLike > ( )
157157
158- const onResult = createEventHook < [ TData , HookContext ] > ( )
158+ const onResultEvent = createEventHook < [ TData , HookContext ] > ( )
159159 const onErrorEvent = createEventHook < [ ErrorLike , HookContext ] > ( )
160160
161161 // Setup loading tracking
@@ -199,16 +199,11 @@ export function useQuery<TData = unknown, TVariables extends OperationVariables
199199 loading . value = false
200200 if ( queryResult . error ) {
201201 error . value = queryResult . error
202- void onErrorEvent . trigger ( queryResult . error , { client } )
203- }
204- else if ( isDefined ( result . value ) ) {
205- void onResult . trigger ( result . value , { client } )
206202 }
207203 }
208204 catch ( e ) {
209205 error . value = e as ErrorLike
210206 loading . value = false
211- void onErrorEvent . trigger ( error . value , { client } )
212207 }
213208 } )
214209 }
@@ -228,7 +223,7 @@ export function useQuery<TData = unknown, TVariables extends OperationVariables
228223 if ( isDefined ( value . data ) || ! options ?. keepPreviousResult ) {
229224 result . value = value . data as TData
230225 if ( isDefined ( result . value ) ) {
231- void onResult . trigger ( value . data as TData , { client } )
226+ void onResultEvent . trigger ( value . data as TData , { client } )
232227 }
233228 }
234229 }
@@ -435,13 +430,13 @@ export function useQuery<TData = unknown, TVariables extends OperationVariables
435430 *
436431 * @example
437432 * ```ts
438- * onResult ((data, context) => {
433+ * onResultEvent ((data, context) => {
439434 * console.log('New data:', data)
440435 * console.log('Apollo client:', context.client)
441436 * })
442437 * ```
443438 */
444- onResult : onResult . on ,
439+ onResult : onResultEvent . on ,
445440
446441 /**
447442 * Manually refetch the query with optional new variables.
0 commit comments