Skip to content

Commit 6e9d36b

Browse files
committed
fix: useDLE return loading and error when args can be null
1 parent 5b64cbf commit 6e9d36b

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

.changeset/proud-dogs-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@data-client/react": patch
3+
---
4+
5+
Fix useDLE return loading and error when args can be null

packages/react/src/hooks/useDLE.native.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export default function useDLE<
6363
): {
6464
data: E['schema'] extends undefined | null ? undefined
6565
: DenormalizeNullable<E['schema']>;
66-
loading: false;
67-
error: undefined;
66+
loading: boolean;
67+
error: ErrorTypes | undefined;
6868
};
6969

7070
export default function useDLE<

packages/react/src/hooks/useDLE.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export default function useDLE<
6161
): {
6262
data: E['schema'] extends undefined | null ? undefined
6363
: DenormalizeNullable<E['schema']>;
64-
loading: false;
65-
error: undefined;
64+
loading: boolean;
65+
error: ErrorTypes | undefined;
6666
};
6767

6868
export default function useDLE<

website/src/components/Playground/editor-types/@data-client/react.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ type AsyncReturn<E> = {
175175
declare function useDLE<E extends EndpointInterface<FetchFunction, Schema | undefined, undefined | false>>(endpoint: E, ...args: readonly [...Parameters<E>]): E['schema'] extends undefined | null ? AsyncReturn<E> : SchemaReturn<E['schema']>;
176176
declare function useDLE<E extends EndpointInterface<FetchFunction, Schema | undefined, undefined | false>>(endpoint: E, ...args: readonly [...Parameters<E>] | readonly [null]): {
177177
data: E['schema'] extends undefined | null ? undefined : DenormalizeNullable<E['schema']>;
178-
loading: false;
179-
error: undefined;
178+
loading: boolean;
179+
error: ErrorTypes$1 | undefined;
180180
};
181181

182182
/**

website/src/components/Playground/editor-types/globals.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,8 @@ type AsyncReturn<E> = {
17651765
declare function useDLE<E extends EndpointInterface$1<FetchFunction$1, Schema$1 | undefined, undefined | false>>(endpoint: E, ...args: readonly [...Parameters<E>]): E['schema'] extends undefined | null ? AsyncReturn<E> : SchemaReturn<E['schema']>;
17661766
declare function useDLE<E extends EndpointInterface$1<FetchFunction$1, Schema$1 | undefined, undefined | false>>(endpoint: E, ...args: readonly [...Parameters<E>] | readonly [null]): {
17671767
data: E['schema'] extends undefined | null ? undefined : DenormalizeNullable$1<E['schema']>;
1768-
loading: false;
1769-
error: undefined;
1768+
loading: boolean;
1769+
error: ErrorTypes$2 | undefined;
17701770
};
17711771

17721772
/**

0 commit comments

Comments
 (0)