Skip to content

Commit 32ca064

Browse files
committed
Fix ReferenceField does not work offline
## Problem ReferenceField hides the (stale) data when the network returns an error. This is not the default behavior of TanStack Query, and this means that ReferenceField will always render empty in offline. ## Solution If the query returns data, even in case of error, return it.
1 parent d761b1a commit 32ca064

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/ra-core/src/controller/useReference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const useReference = <
8585
otherQueryOptions
8686
);
8787
return {
88-
referenceRecord: error ? undefined : data ? data[0] : undefined,
88+
referenceRecord: data ? data[0] : undefined,
8989
refetch,
9090
error,
9191
isLoading,

0 commit comments

Comments
 (0)