Skip to content

Commit 94c32c1

Browse files
committed
fix(useConnectMutation): fix false positive when "variables" in ref is available but undefined
1 parent bd467c5 commit 94c32c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react/src/data-connect/useConnectMutation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export function useConnectMutation<
5252
onSuccess(...args) {
5353
if (options?.invalidate && options.invalidate.length) {
5454
for (const ref of options.invalidate) {
55-
if ("variables" in ref) {
55+
if ("variables" in ref && ref.variables !== undefined) {
5656
queryClient.invalidateQueries({
57-
queryKey: [ref.name, ref.variables || null],
57+
queryKey: [ref.name, ref.variables],
5858
exact: true,
5959
});
6060
} else {
6161
queryClient.invalidateQueries({
62-
queryKey: [ref().name],
62+
queryKey: [ref.name],
6363
});
6464
}
6565
}

0 commit comments

Comments
 (0)