helix

https://github.com/Lokeh/helix
dominicm 2020-05-26T08:56:45.029200Z

Just learned another cause of refresh not working - not installing react devtools :)

🤯 1
2020-05-26T14:37:15.031200Z

I'm making another 'REBL inspector' thing with Smalltalk-ey floating windows: https://github.com/jc776/bubble

2
lilactown 2020-05-26T15:29:47.031800Z

Very cool!!!

lilactown 2020-05-26T15:30:23.032600Z

I tried something similar myself but didn’t get nearly that far 😅

lilactown 2020-05-26T15:43:41.033800Z

@spacemods I see you created a way of handling reloading components with hooks. Did the fast-refresh / react-refresh integration not work for you?

Derek Passen 2020-05-26T15:45:49.034400Z

How do we deal with peer dependencies on ‘react’ with the deps.cljs in 0.11?

lilactown 2020-05-26T15:46:20.034700Z

:thinking_face: can you explain what you mean?

lilactown 2020-05-26T15:46:32.035100Z

this is the second time someone has brought up issues with deps.cljs

Derek Passen 2020-05-26T15:47:54.035700Z

I suppose it’s not a big deal. A lot of libraries declare a peer dependency on react directly

Derek Passen 2020-05-26T15:48:09.036200Z

Is the recommended way of using helix to omit react from package.json?

lilactown 2020-05-26T15:48:30.036400Z

no

Derek Passen 2020-05-26T15:49:25.037200Z

Oh okay

lilactown 2020-05-26T15:52:00.039600Z

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

Derek Passen 2020-05-26T15:52:11.040Z

I see an error (not sure if shadow or helix) when I upgrade:

IllegalArgumentException: No matching field found: exist for class <http://java.io|java.io>.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)

Derek Passen 2020-05-26T15:52:39.040400Z

I can try to carve out a minimal repro if this is new/unknown

lilactown 2020-05-26T15:52:42.040600Z

hm

lilactown 2020-05-26T15:52:47.040800Z

I haven’t seen that

lilactown 2020-05-26T15:52:52.041Z

do you have a package.json file?

Derek Passen 2020-05-26T15:52:56.041200Z

yes

lilactown 2020-05-26T15:53:32.041500Z

yeah, it might be a bug in shadow?

lilactown 2020-05-26T15:53:37.041700Z

I would try and repro it

lilactown 2020-05-26T15:54:34.042Z

i’m going to bump our project at work just to be sure

Derek Passen 2020-05-26T15:55:22.042300Z

Looks like it broke from shadow 2.9.8 to 2.9.9

Derek Passen 2020-05-26T16:02:34.042900Z

So deps.cljs get written to my package.json, nice!

lilactown 2020-05-26T16:02:47.043100Z

woo!

lilactown 2020-05-26T16:02:57.043400Z

but yes, feel free to override react however you like

Derek Passen 2020-05-26T16:03:07.043900Z

That makes way more sense than my mental model earlier

lilactown 2020-05-26T19:55:58.044700Z

and I guess you don’t mind losing local state much since you’re storing most of it in a global atom?

2020-05-26T21:27:24.044900Z

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?

lilactown 2020-05-26T21:36:22.045100Z

hmm yeah, I guess as long as you keep the function reference the same it won’t re-mount the component :thinking_face:

lilactown 2020-05-26T21:38:34.045300Z

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

lilactown 2020-05-26T21:38:52.045500Z

but it might be just as easy to support that in what you’re doing which is just keeping the reference stable

lilactown 2020-05-26T21:38:54.045700Z

I like it!

lilactown 2020-05-26T21:39:03.045900Z

very clever

2020-05-26T22:32:12.046100Z

cool, thanks!