From a2e53d28174bbc584cae20621e481afff550ac40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Emir=20=C5=9Een?= Date: Wed, 29 May 2024 09:48:47 +0300 Subject: [PATCH] fix(devtools-internal): fix `NODE_ENV` conditional (#5992) --- .changeset/tall-doors-ring.md | 7 +++++++ packages/devtools-internal/src/use-query-subscription.tsx | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/tall-doors-ring.md diff --git a/.changeset/tall-doors-ring.md b/.changeset/tall-doors-ring.md new file mode 100644 index 000000000000..668cd45064c5 --- /dev/null +++ b/.changeset/tall-doors-ring.md @@ -0,0 +1,7 @@ +--- +"@refinedev/devtools-internal": patch +--- + +fix(devtools-internal): broken env conditional in useQuerySubscription hook + +When using Refine with React Native, `process.env.NODE_ENV !== "development" ? () => ({}) : () => {...}` conditional in `useQuerySubscription` hook was causing a syntax error. This PR fixes the issue by explicitly returning an empty object on non-development environments. diff --git a/packages/devtools-internal/src/use-query-subscription.tsx b/packages/devtools-internal/src/use-query-subscription.tsx index 183e4f2a4e4a..a79908551d53 100644 --- a/packages/devtools-internal/src/use-query-subscription.tsx +++ b/packages/devtools-internal/src/use-query-subscription.tsx @@ -9,7 +9,9 @@ import { createQueryListener, createMutationListener } from "./listeners"; export const useQuerySubscription = __DEV_CONDITION__ !== "development" - ? () => ({}) + ? () => { + return {}; + } : (queryClient: QueryClient) => { const { ws } = useContext(DevToolsContext); const queryCacheSubscription = React.useRef<() => void>();