Skip to content

Commit 905f4f6

Browse files
committed
value -> data
1 parent f790cb3 commit 905f4f6

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -707,17 +707,17 @@ export type UseQueryPreloadedOptions<Query extends FunctionReference<"query">> =
707707
export type UseQueryResult<T> =
708708
| {
709709
status: "success";
710-
value: T;
710+
data: T;
711711
error: undefined;
712712
}
713713
| {
714714
status: "error";
715-
value: undefined;
715+
data: undefined;
716716
error: Error;
717717
}
718718
| {
719719
status: "loading";
720-
value: undefined;
720+
data: undefined;
721721
error: undefined;
722722
};
723723

@@ -841,7 +841,7 @@ export function useQuery<Query extends FunctionReference<"query">>(
841841
}
842842
return {
843843
status: "error",
844-
value: undefined,
844+
data: undefined,
845845
error: result,
846846
} satisfies UseQueryResult<Query["_returnType"]>;
847847
}
@@ -851,20 +851,20 @@ export function useQuery<Query extends FunctionReference<"query">>(
851851
if (fallbackValue !== undefined) {
852852
return {
853853
status: "success",
854-
value: fallbackValue,
854+
data: fallbackValue,
855855
error: undefined,
856856
} satisfies UseQueryResult<Query["_returnType"]>;
857857
}
858858
return {
859859
status: "loading",
860-
value: undefined,
860+
data: undefined,
861861
error: undefined,
862862
} satisfies UseQueryResult<Query["_returnType"]>;
863863
}
864864

865865
return {
866866
status: "success",
867-
value: result,
867+
data: result,
868868
error: undefined,
869869
} satisfies UseQueryResult<Query["_returnType"]>;
870870
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe("useQuery types", () => {
110110

111111
const {
112112
status: _status,
113-
value: _value,
113+
data: _data,
114114
error: _error,
115115
} = useQuery({
116116
query: api.module.args,
@@ -119,13 +119,13 @@ describe("useQuery types", () => {
119119
throwOnError: true,
120120
});
121121
if (_status === "success") {
122-
expectTypeOf(_value).toEqualTypeOf("initial value");
122+
expectTypeOf(_data).toEqualTypeOf("initial value");
123123
}
124124
if (_status === "error") {
125125
expectTypeOf(_error).toEqualTypeOf<Error>();
126126
}
127127
if (_status === "loading") {
128-
expectTypeOf(_value).toEqualTypeOf<undefined>();
128+
expectTypeOf(_data).toEqualTypeOf<undefined>();
129129
}
130130

131131
useQuery("skip");
@@ -134,7 +134,7 @@ describe("useQuery types", () => {
134134
test("Queries with preloaded options", () => {
135135
const {
136136
status: _status,
137-
value: _value,
137+
data: _data,
138138
error: _error,
139139
} = useQuery({
140140
preloaded: {} as Preloaded<typeof api.module.noArgs>,

0 commit comments

Comments
 (0)