Skip to content

Commit

Permalink
fix: variables reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
yurks committed Jun 6, 2024
1 parent bf01d6b commit d5bd931
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vue-urql/src/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type UseQueryArgs<
* documentation on the `pause` option.
*/
pause?: MaybeRef<boolean>;
} & MaybeRefObj<GraphQLRequestParams<Data, Variables>>;
} & MaybeRefObj<GraphQLRequestParams<Data, MaybeRefObj<Variables>>>;

/** State of the current query, your {@link useQuery} function is executing.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-urql/src/useSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type UseSubscriptionArgs<
* ```
*/
context?: MaybeRef<Partial<OperationContext>>;
} & MaybeRefObj<GraphQLRequestParams<Data, Variables>>;
} & MaybeRefObj<GraphQLRequestParams<Data, MaybeRefObj<Variables>>>;

/** Combines previous data with an incoming subscription result’s data.
*
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-urql/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import type { Ref, ShallowRef } from 'vue';
import { isRef } from 'vue';

export type MaybeRef<T> = T | (() => T) | Ref<T>;
export type MaybeRefObj<T extends {}> = { [K in keyof T]: MaybeRef<T[K]> };
export type MaybeRefObj<T> = T extends {}
? { [K in keyof T]: MaybeRef<T[K]> }
: T;

export const unref = <T>(maybeRef: MaybeRef<T>): T =>
typeof maybeRef === 'function'
Expand Down

0 comments on commit d5bd931

Please sign in to comment.