Skip to content

Commit f790cb3

Browse files
committed
drop skip object arg
1 parent 7dd63aa commit f790cb3

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

npm-packages/convex/src/react/client.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,6 @@ export type UseQueryOptions<Query extends FunctionReference<"query">> = {
665665
* @defaultValue undefined
666666
*/
667667
initialValue?: Query["_returnType"];
668-
/**
669-
* When true, the query will not be subscribed and it will behave the same as
670-
* if it was loading.
671-
* @defaultValue false
672-
*/
673-
skip?: boolean;
674668
} & (FunctionArgs<Query> extends EmptyObject
675669
? {
676670
/**
@@ -703,12 +697,6 @@ export type UseQueryPreloadedOptions<Query extends FunctionReference<"query">> =
703697
* @defaultValue false
704698
*/
705699
throwOnError?: boolean;
706-
/**
707-
* When true, the query will not be subscribed and it will behave the same as
708-
* if it was loading.
709-
* @defaultValue false
710-
*/
711-
skip?: boolean;
712700
};
713701

714702
/**
@@ -786,8 +774,7 @@ export function useQuery<Query extends FunctionReference<"query">>(
786774
typeof queryOrOptions === "object" &&
787775
queryOrOptions !== null &&
788776
("query" in queryOrOptions || "preloaded" in queryOrOptions);
789-
const isObjectSkip =
790-
queryOrOptions === "skip" || (isObjectOptions && !!queryOrOptions.skip);
777+
const isObjectSkip = queryOrOptions === "skip";
791778
const isLegacy = !isObjectOptions && !isObjectSkip;
792779
const legacySkip = isLegacy && args[0] === "skip";
793780
const isObjectReturn = isObjectOptions || isObjectSkip;

npm-packages/convex/src/react/use_query.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,16 @@ describe("useQuery types", () => {
9797
throwOnError: true,
9898
});
9999

100-
useQuery({
101-
query: api.module.args,
102-
args: { _arg: "asdf" },
103-
skip: true,
104-
});
100+
const _arg: string | undefined = undefined;
101+
102+
useQuery(
103+
!_arg
104+
? "skip"
105+
: {
106+
query: api.module.args,
107+
args: { _arg },
108+
},
109+
);
105110

106111
const {
107112
status: _status,

0 commit comments

Comments
 (0)