From 98604bfab1a66bc82c619bfa4964584f8ee6f87e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 12 Sep 2021 15:48:53 +0200 Subject: [PATCH] catalog-react: switch back to providing empty context from useEntity Signed-off-by: Patrik Oldsberg --- plugins/catalog-react/src/hooks/useEntity.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 1f438f19a0..bcb38bb807 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -169,7 +169,15 @@ export function useEntity() { useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); if (!versionedHolder) { - throw new Error('Entity context is not available'); + // TODO(Rugvip): Throw this once we fully migrate to the new context + // throw new Error('Entity context is not available'); + + return { + entity: undefined as unknown as T, + loading: true, + error: undefined, + refresh: () => {}, + }; } const value = versionedHolder.atVersion(1);