Fork me on GitHub
#shadow-cljs
<
2022-02-14
>
steveb8n01:02:26

excluding tests using :ns-regexp is driving me crazy. I presume this is a jvm regex but I’m terrible at regex. how do I run all tests except those with the word “render” in the name? e.g. don’t include big-render-test

steveb8n01:02:20

I’ve been trying it in the repl and I can make it work there using

(re-find #"^\b([a-z\-]+)\b(?<!render|ignoreme)-test" "first-render-test")

steveb8n01:02:33

but that doesn’t work inside the shadow file

steveb8n01:02:11

is there a recommended way to test these expressions in the REPL that will also work in shadow edn file?

steveb8n03:02:07

fwiw. not complaining about shadow. just having a hard time testing regexes and then using them in CI

Drew Verlee04:02:16

edit: nevermind it found it just found. If i add a dep to the devDependencies of package.json how do i declare i want that included in my shadow-cljs build? I have only ever used all dev deps.

UlisesMAC05:02:17

Hi there! :) I want to get the logs from shadow-cljs that are showed in CLI when the compilation fails. Anyone knows if there is a var to get it? I tried to get them from the compiler state using build-hooks but I hadn't luck. I want to report them in the UI when using react-native.

thheller06:02:57

someone built something like that before. can't remember who though. its all available via :devtools {:build-notify } whereas that points to a regular defn receiving on argument which is a map which is the same as this msg https://github.com/thheller/shadow-cljs/blob/8ef958f332c0e0648fd84eb2a3d5205602487f6b/src/main/shadow/cljs/devtools/client/hud.cljs#L263

👍 1
thheller06:02:09

maybe you can figure out what you need out of that

tianshu09:02:19

Sometimes I ran into this error when compile

------ ERROR -------------------------------------------------------------------
 File: jar:file:/home/tianshu/.m2/repository/org/clojure/core.async/1.3.618/core.async-1.3.618.jar!/cljs/core/async/impl/channels.cljs:23:3
--------------------------------------------------------------------------------
  20 | (deftype PutBox [handler val])
  21 | 
  22 | (defn put-active? [box]
  23 |   (impl/active? (.-handler box)))
---------^----------------------------------------------------------------------
null
ClassCastException: clojure.lang.KeywordLookupSite$1 incompatible with clojure.lang.Named
I'm sure I have only one jvm running. Everytime the error is different, but I've seen clojure.lang.KeywordLookupSite multiple times

thheller17:02:28

@doglooksgood that is the wrong core.async version. make sure you are using the version shadow-cljs is expecting. don't know which shadow-cljs version you are using but should likely be [org.clojure/core.async "1.4.627"]

👍 1
bringe17:02:04

Hello. I want to share this message I posted in #cljsrn here to see if someone here might be able to share some knowledge about the issue. Thanks!

bringe17:02:19

There’s a video of the issue in that thread, and version details.

Clement San17:02:20

Hello, i'm trying to integrate reagent-material-ui 5.2.4-0 with an app created with luminus (https://github.com/clementlefevre/luminus_reagent_material_ui) Seems that the @mui/x-data-grid": "5.2.0" does not load as expected : compilation with shadow-cljs watch app` runs fine, but when loading the page http://localhost:3000/#/about i get the following error :

js.js:74 shadow-cljs - failed to load module$node_modules$$mui$material$node$index
shadow.js.jsRequire @ js.js:74
shadow$provide.module$node_modules$$mui$x_data_grid$index_cjs @ index-cjs.js:3
shadow.js.jsRequire @ js.js:66
shadow.js.require @ js.js:113
eval @ reagent_mui.x.data_grid.js:2
goog.globalEval @ app.js:488
env.evalLoad @ app.js:1563
(anonymous) @ app.js:2782
js.js:74 shadow-cljs - failed to load module$node_modules$$mui$x_data_grid$index_cjs
shadow.js.jsRequire @ js.js:74
shadow.js.require @ js.js:113
eval @ reagent_mui.x.data_grid.js:2
goog.globalEval @ app.js:488
env.evalLoad @ app.js:1563
(anonymous) @ app.js:2782
app.js:1455 TypeError: Cannot redefine property: ModalManager
    at Function.defineProperty (<anonymous>)
    at eval (index.js:2038:10)
    at Array.forEach (<anonymous>)
    at Object.shadow$provide.module$node_modules$$mui$material$node$index (index.js:2034:21)
    at shadow.js.jsRequire (js.js:66:18)
    at Object.shadow$provide.module$node_modules$$mui$x_data_grid$index_cjs (index-cjs.js:3:118)
    at Object.shadow.js.jsRequire (js.js:66:18)
    at Object.shadow.js.require (js.js:113:20)
    at eval (reagent_mui.x.data_grid.js:2:62)
    at eval (<anonymous>)
reportError @ app.js:1455
env.evalLoad @ app.js:1565
(anonymous) @ app.js:2782
app.js:1457 The above error occurred when loading "reagent_mui.x.data_grid.js". Any additional errors after that one may be the result of that failure. In general your code cannot be trusted to execute properly after such a failure. Make sure to fix the first one before looking at others.
p-himik already provided a lot of https://clojurians.slack.com/team/U2FRKM4TW, unfortunately the error does still persist. any help would be helpful, as the perspective to switch back to bare javascript does not trigger any joy. Thanks a lot for your time ! Cheers, clement.

thheller17:02:17

@clement.san my guess would be that you are using the wrong version mix. ie. @mui/x-data-grid expecting a difference @mui/material version?

thheller17:02:17

"@material-ui/core": "4.11.3",
    "@mui/material": "5.2.4",
    "@mui/x-data-grid": "5.2.0",

thheller17:02:32

isnt @mui/material the new "@material-ui/core"? why do you have both?

Clement San17:02:29

@thheller Hallo Thomas, thanks for the feedback

Clement San17:02:39

I did adjust the package.json accordingly :

"dependencies": {
    "@emotion/react": "11.0.0",
    "@emotion/styled": "11.0.0",
    "@mui/material": "5.2.4",
    "@mui/x-data-grid": "5.2.4",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  }
and then npm install & shadow-cljs watch app leider still getting the same error in the dev tools :
shadow-cljs - failed to load module$node_modules$$mui$material$node$index
shadow.js.jsRequire @ js.js:74
shadow$provide.module$node_modules$$mui$x_data_grid$index_cjs @ index-cjs.js:3
shadow.js.jsRequire @ js.js:66
shadow.js.require @ js.js:113
eval @ reagent_mui.x.data_grid.js:2
goog.globalEval @ app.js:488
env.evalLoad @ app.js:1563
(anonymous) @ app.js:2779
js.js:74 shadow-cljs - failed to load module$node_modules$$mui$x_data_grid$index_cjs
shadow.js.jsRequire @ js.js:74
shadow.js.require @ js.js:113
eval @ reagent_mui.x.data_grid.js:2
goog.globalEval @ app.js:488
env.evalLoad @ app.js:1563
(anonymous) @ app.js:2779
app.js:1455 TypeError: Cannot redefine property: ModalManager
    at Function.defineProperty (<anonymous>)
    at eval (index.js:2038:10)
    at Array.forEach (<anonymous>)
    at Object.shadow$provide.module$node_modules$$mui$material$node$index (index.js:2034:21)
    at shadow.js.jsRequire (js.js:66:18)
    at Object.shadow$provide.module$node_modules$$mui$x_data_grid$index_cjs (index-cjs.js:3:118)
    at Object.shadow.js.jsRequire (js.js:66:18)
    at Object.shadow.js.require (js.js:113:20)
    at eval (reagent_mui.x.data_grid.js:2:62)
    at eval (<anonymous>)
reportError @ app.js:1455
env.evalLoad @ app.js:1565
(anonymous) @ app.js:2779
app.js:1457 The above error occurred when loading "reagent_mui.x.data_grid.js". Any additional errors after that one may be the result of that failure. In general your code cannot be trusted to execute properly after such a failure. Make sure to fix the first one before looking at others.

thheller17:02:59

try :js-options {:entry-keys ["module" "browser" "main"]}} in your build config

Clement San17:02:25

Compiling ...

Clement San18:02:34

OK, no error on loading page the now, thanks, that means the [reagent-mui.x.data-grid :refer [data-grid]] require is now working ! but when using the data-grid component in the hiccup i now get the following error :

index-esm.js:6943 Uncaught TypeError: Cannot read properties of undefined (reading 'useRef')
    at eval (index-esm.js:6943:25)
    at Xi (index-esm.js:6942:12)
    at Ss (index-esm.js:8390:3)
    at eval (index-esm.js:9742:10)
    at renderWithHooks (react-dom.development.js:14986:18)
    at updateForwardRef (react-dom.development.js:17045:20)
    at beginWork (react-dom.development.js:19099:16)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3946:14)
    at Object.invokeGuardedCallbackImpl (react-dom.development.js:3995:16)
    at invokeGuardedCallback (react-dom.development.js:4057:31)
eval @ index-esm.js:6943
Xi @ index-esm.js:6942
Ss @ index-esm.js:8390
eval @ index-esm.js:9742
renderWithHooks @ react-dom.development.js:14986
updateForwardRef @ react-dom.development.js:17045
beginWork @ react-dom.development.js:19099
callCallback @ react-dom.development.js:3946
invokeGuardedCallbackImpl @ react-dom.development.js:3995
invokeGuardedCallback @ react-dom.development.js:4057
beginWork$1 @ react-dom.development.js:23965
performUnitOfWork @ react-dom.development.js:22780
workLoopSync @ react-dom.development.js:22708
renderRootSync @ react-dom.development.js:22671
performSyncWorkOnRoot @ react-dom.development.js:22294
eval @ react-dom.development.js:11328
exports.unstable_runWithPriority @ scheduler.development.js:469
runWithPriority$1 @ react-dom.development.js:11277
flushSyncCallbackQueueImpl @ react-dom.development.js:11323
flushSyncCallbackQueue @ react-dom.development.js:11310
scheduleUpdateOnFiber @ react-dom.development.js:21894
updateContainer @ react-dom.development.js:25483
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26038
exports.render @ react-dom.development.js:26104
reagent$dom$render_comp @ dom.cljs:18
eval @ dom.cljs:48
eval @ dom.cljs:38
luminus_reagent_material_ui$core$mount_components @ core.cljs:132
eval @ env.cljs:211
shadow$cljs$devtools$client$env$do_js_reload_STAR_ @ env.cljs:220
G__58170 @ env.cljs:220
eval @ env.cljs:249
shadow$cljs$devtools$client$env$do_js_reload_STAR_ @ env.cljs:220
eval @ env.cljs:256
shadow$cljs$devtools$client$browser$do_js_reload @ browser.cljs:43
eval @ browser.cljs:93
eval @ shared.cljs:32
shadow$remote$runtime$shared$process @ shared.cljc:164
eval @ shared.cljs:289
shadow$cljs$devtools$client$shared$remote_msg @ shared.cljs:16
eval @ websocket.cljs:16
Show 11 more frames
react-dom.development.js:20086 The above error occurred in the <ForwardRef> component:

    at eval ()
    at cmp ()
    at div
    at cmp ()
    at div
    at div
    at section
    at cmp ()
    at cmp ()

Consider adding an error boundary to your tree to customize error handling behavior.
Visit  to learn more about error boundaries.

thheller18:02:37

really tough too say. too many things in this example. trim down some of the dependency and just use mui directly

thheller18:02:43

that would at least make it debuggable

thheller18:02:45

when switching to ESM modules (which you did via the :entry-keys) sometimes some requires change

thheller18:02:51

:as becomes :default or so