Skip to content

Commit

Permalink
fix(devtools-internal): fix NODE_ENV conditional (#5992)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliemir authored and BatuhanW committed Jun 4, 2024
1 parent 642ef10 commit 6584d6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/tall-doors-ring.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 3 additions & 1 deletion packages/devtools-internal/src/use-query-subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down

0 comments on commit 6584d6f

Please sign in to comment.