Skip to content

Commit 65e8759

Browse files
committed
fix: preset - createQuery wrong overloads
1 parent 4b4d710 commit 65e8759

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/rare-snails-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"mobx-tanstack-query": patch
3+
---
4+
5+
fixed createQuery wrong overloads

src/preset/create-query.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,14 @@ export function createQuery(...args: [any, any?]) {
8585
},
8686
});
8787
} else if (args.length === 2) {
88-
return new Query(args[0], args[1]());
88+
return new Query(
89+
args[0],
90+
typeof args[1] === 'function' ? args[1] : () => args[1],
91+
);
8992
}
9093

91-
return new Query(queryClient, args[0]);
94+
return new Query(
95+
queryClient,
96+
typeof args[0] === 'function' ? args[0] : () => args[0],
97+
);
9298
}

0 commit comments

Comments
 (0)