This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-24
Channels
any user of react-query 4 series ? I'm having hard time trying to make ReactQueryDevtools to work. it has a condition depending on NODE_ENV to include component https://github.com/TanStack/query/blob/e9d62f4e125a9773559e5ed82f32fec5bd48a15e/packages/react-query-devtools/src/index.ts#L4 Even with export NODE_ENV=development at desktop level It does not work. Do you have any clue about this ? I'm asking here because I'm compiling with shadow. Can it be closure compiler ?
@geraldodev never look at the source code of a library to diagnose errors. this is typescript, so the actual code you are consuming is different
they say this conditional is for the devtools not to be included in the production version. What I'm seeing is a null function even with NODE_ENV = development on my .zshenv . When I invoke it returns null
sorry I'm missing context. what are you doing exactly? you are seeing a null function where?
The context is
(:require
["@tanstack/react-query-devtools" :refer [ReactQueryDevtools]]
....
(js/console.log "devtools function" (ReactQueryDevtools))
ah, I guess you are trying this https://tanstack.com/query/v4/docs/devtools?
yes 4.0.10 version
but you are calling it as a function when it is not a function? it is a react component?
just to prove that it s returning nothing.
https://github.com/TanStack/query/blob/e9d62f4e125a9773559e5ed82f32fec5bd48a15e/packages/react-query-devtools/src/index.ts#L6 like in this variant
I did that after ($ ReactQueryDevtools) render nothing. $ is helix React.createElement
if has a "browser": "build/umd/index.production.js",
in its package.json, which tells shadow-cljs to include that file
and https://unpkg.com/browse/@tanstack/[email protected]/build/umd/index.production.js just returns null always
what you can do is :dev {:js-options {:resolve {"@tanstack/react-query-devtools" {:target :npm :require "@tanstack/react-query-devtools/dist/umd/index.development.js"}}}
in your build config
That'll do it. Thank's a lot. This little tool is invaluable to see what queries are in the cache.
It says ExceptionInfo: :resolve override for "@tanstack/react-query-devtools" to "@tanstack/[email protected]/build/dist/umd/index.development.js" which does not exist . In that case shadow try to fetch itself ?
notice the @4.0.10
, that needs to go, all it does it get node_modules/@tanstack/react-query-devtools/dist/umd/index.development.js
I did without it before
oh i see.. it goes for the already fetched package on node modules directory
grep devtools yarn.lock "@tanstack/react-query-devtools@^4.0.10": resolved "https://registry.yarnpkg.com/@tanstack/react-query-devtools/-/react-query-devtools-4.0.10.tgz#d1b3e5b1917f1c22bcee5830ef7af1ccfc4879f4"
resolve override for "@tanstack/react-query-devtools" to "@tanstack/react-query-devtools/dist/umd/index.development.js" which does not exist {:tag :shadow.build.resolve/invalid-override, :require-from nil, :require "@tanstack/react-query-devtools", :other "@tanstack/react-query-devtools/dist/umd/index.development.js"} ExceptionInfo: :resolve override for "@tanstack/react-query-devtools" to "@tanstack/react-query-devtools/dist/umd/index.development.js" which does not exist
and check you are in the correct folder if you use :js-package-dirs
in the build config as well?
its @tanstack/react-query-devtools/build/umd/index.development.js
and you are in the correct folder? I mean the directory that the shadow-cljs.edn file is in and then node_modules/@tanstack/react-query-devtools/dist/umd/index.development.js
from there?
Now it's not complaining anymore. But I'm seeing a pattern: Its looks like its the package 🙂 (as always)
Because the development version returns null. umd/index.development.js
I guess you can change it to node_modules/@tanstack/react-query-devtools/dist/esm/index.js
they declare a bunch of unicode chars on that file
Errors encountered while trying to parse file /home/geraldo/projetos/crudis/node_modules/@tanstack/react-query-devtools/build/esm/index.js {:line 158, :column 3, :message "Character '̆' (U+0306) is not a valid identifier start char"}
But now I know the root cause, I'll ask them to fix the umd file. Thank you @thheller
https://github.com/google/closure-compiler/issues/3639 old issue unfortunately
https://codesandbox.io/s/intelligent-heisenberg-srmx02 if I try a code sandbox to repro and open the issue it does not happen 🙂 I guess it's operating at typescript level.
you can just use webpack as described here https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
I was talking about the null component file. That does not happen on the codesandbox.
they appear to be using rollup