Skip to content

Commit e50cdcb

Browse files
committed
chore: Formatting
1 parent ab51eb1 commit e50cdcb

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

packages/react/src/data-connect/useDataConnectQuery.test.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe("useDataConnectQuery", () => {
118118
const { result } = renderHook(() => useDataConnectQuery(listMoviesRef()), {
119119
wrapper,
120120
});
121-
121+
122122
await waitFor(() => expect(result.current.isSuccess).toBe(true));
123123

124124
result.current.data?.movies.forEach((i) => {
@@ -216,9 +216,13 @@ describe("useDataConnectQuery", () => {
216216
test("avails the data immediately when initialData is passed", async () => {
217217
const queryResult = await executeQuery(listMoviesRef());
218218

219-
const { result } = renderHook(() => useDataConnectQuery(listMoviesRef(), { initialData: queryResult.data }), {
220-
wrapper,
221-
});
219+
const { result } = renderHook(
220+
() =>
221+
useDataConnectQuery(listMoviesRef(), { initialData: queryResult.data }),
222+
{
223+
wrapper,
224+
},
225+
);
222226

223227
// Should not enter a loading state
224228
expect(result.current.isLoading).toBe(false);

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

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { InitialDataFunction, type UseQueryOptions, useQuery } from "@tanstack/react-query";
1+
import {
2+
type InitialDataFunction,
3+
type UseQueryOptions,
4+
useQuery,
5+
} from "@tanstack/react-query";
26
import type { FirebaseError } from "firebase/app";
37
import {
48
type CallerSdkType,
@@ -20,15 +24,13 @@ export type useDataConnectQueryOptions<
2024
> = PartialBy<Omit<UseQueryOptions<TData, TError>, "queryFn">, "queryKey">;
2125

2226
export function useDataConnectQuery<Data = unknown, Variables = unknown>(
23-
refOrResult: QueryRef<Data, Variables>
24-
| QueryResult<Data, Variables>,
25-
options?: useDataConnectQueryOptions<
26-
Data,
27-
FirebaseError
28-
>,
29-
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackReactCore
27+
refOrResult: QueryRef<Data, Variables> | QueryResult<Data, Variables>,
28+
options?: useDataConnectQueryOptions<Data, FirebaseError>,
29+
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.TanstackReactCore,
3030
): UseDataConnectQueryResult<Data, Variables> {
31-
const [dataConnectResult, setDataConnectResult] = useState<QueryResultRequiredRef<Data, Variables>>('ref' in refOrResult ? refOrResult : { ref: refOrResult });
31+
const [dataConnectResult, setDataConnectResult] = useState<
32+
QueryResultRequiredRef<Data, Variables>
33+
>("ref" in refOrResult ? refOrResult : { ref: refOrResult });
3234
// TODO(mtewani): in the future we should allow for users to pass in `QueryResult` objects into `initialData`.
3335
let initialData: Data | InitialDataFunction<Data> | undefined;
3436
const { ref } = dataConnectResult;

0 commit comments

Comments
 (0)