This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-26
Channels
- # announcements (7)
- # babashka (42)
- # beginners (349)
- # chlorine-clover (9)
- # cider (16)
- # circleci (2)
- # clj-kondo (6)
- # cljs-dev (61)
- # cljsrn (15)
- # clojure (95)
- # clojure-europe (11)
- # clojure-italy (2)
- # clojure-nl (4)
- # clojure-spec (4)
- # clojure-uk (24)
- # clojurescript (21)
- # conjure (2)
- # core-async (8)
- # cursive (12)
- # datascript (2)
- # emacs (4)
- # exercism (1)
- # figwheel-main (86)
- # fulcro (27)
- # graalvm (4)
- # helix (36)
- # hoplon (3)
- # interop (44)
- # kaocha (6)
- # lein-figwheel (4)
- # malli (7)
- # meander (9)
- # off-topic (95)
- # pathom (33)
- # pedestal (13)
- # re-frame (20)
- # reitit (3)
- # shadow-cljs (102)
- # tools-deps (14)
- # xtdb (16)
Just learned another cause of refresh not working - not installing react devtools :)
I'm making another 'REBL inspector' thing with Smalltalk-ey floating windows: https://github.com/jc776/bubble
@spacemods I see you created a way of handling reloading components with hooks. Did the fast-refresh / react-refresh integration not work for you?
The regular 'react-refresh' integration does work OK - no problems. I find it easier to follow "what's going on" on reload with this one given the rule "it's the same function, so state+hooks are preserved". react-refresh does the same with internal fibers/roots. Since it always re-renders "from the top", it might do a little better at 'transitive dependencies' & inputs that aren't components. I also haven't needed any node/webpack yet, although a 'cljsjs.react-refresh' would also do the same.
and I guess you donât mind losing local state much since youâre storing most of it in a global atom?
I'm not noticing any local state being lost - the selected tab in 'TabView' is local; seems to be preserved in small changes to the window, tab view, the 'register-inspector' and all. It does reset on breaking changes to nesting or order without 'key', and deliberately when hooks change - does react-refresh do something more clever than 'reset' for changes to hooks?
hmm yeah, I guess as long as you keep the function reference the same it wonât re-mount the component :thinking_face:
react-hooks technically supports the ability to differentiate between different âkindsâ of hooks changes - e.g. if you change the body of an effect, it wonât re-mount. but if you change the order of hooks or change the initial state, it will re-mount
but it might be just as easy to support that in what youâre doing which is just keeping the reference stable
How do we deal with peer dependencies on âreactâ with the deps.cljs in 0.11?
I suppose itâs not a big deal. A lot of libraries declare a peer dependency on react directly
Is the recommended way of using helix to omit react from package.json?
Oh okay
AFAICT deps.cljs allows me to do a few things:
⢠improve the âquick startâ experience because I donât even need to talk about installing via npm, if you donât care what React version you use
⢠ensure that all npm libs are installed, e.g. react-refresh, before enabling feature flags by default in the future
⢠improve dev experience when used with the new :bundle
target
I see an error (not sure if shadow or helix) when I upgrade:
IllegalArgumentException: No matching field found: exist for class .File
clojure.lang.Reflector.getInstanceField (Reflector.java:397)
clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:440)
shadow.cljs.devtools.server.npm-deps/install-deps (npm_deps.clj:160)
shadow.cljs.devtools.server.npm-deps/install-deps (npm_deps.clj:131)
shadow.cljs.devtools.server.npm-deps/main (npm_deps.clj:242)
shadow.cljs.devtools.server.npm-deps/main (npm_deps.clj:228)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:141)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
clojure.core/apply (core.clj:669)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli/-main (cli.clj:75)
shadow.cljs.devtools.cli/-main (cli.clj:67)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.main/main-opt (main.clj:514)
clojure.main/main-opt (main.clj:510)
clojure.main/main (main.clj:664)
clojure.main/main (main.clj:616)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
I can try to carve out a minimal repro if this is new/unknown
Looks like it broke from shadow 2.9.8 to 2.9.9
So deps.cljs get written to my package.json, nice!
That makes way more sense than my mental model earlier
The regular 'react-refresh' integration does work OK - no problems. I find it easier to follow "what's going on" on reload with this one given the rule "it's the same function, so state+hooks are preserved". react-refresh does the same with internal fibers/roots. Since it always re-renders "from the top", it might do a little better at 'transitive dependencies' & inputs that aren't components. I also haven't needed any node/webpack yet, although a 'cljsjs.react-refresh' would also do the same.