diff --git a/packages/ra-core/src/core/useResourceContext.ts b/packages/ra-core/src/core/useResourceContext.ts index e0a7e570137..38c1f3e1ba2 100644 --- a/packages/ra-core/src/core/useResourceContext.ts +++ b/packages/ra-core/src/core/useResourceContext.ts @@ -42,5 +42,5 @@ export const useResourceContext = < props?: ResourceInformationsType ): ResourceContextValue => { const context = useContext(ResourceContext); - return props.resource || context; + return (props && props.resource) || context; };