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(vue): Fix regression causing variables to not be reactive #3605

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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