This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-22
Channels
- # announcements (2)
- # aws (5)
- # babashka (17)
- # beginners (108)
- # calva (28)
- # chlorine-clover (7)
- # clj-kondo (14)
- # cljs-dev (9)
- # cljsrn (2)
- # clojure (118)
- # clojure-europe (50)
- # clojure-finland (5)
- # clojure-france (15)
- # clojure-italy (9)
- # clojure-nl (14)
- # clojure-spec (11)
- # clojure-uk (43)
- # clojuredesign-podcast (1)
- # clojurescript (35)
- # clojutre (2)
- # clr (3)
- # community-development (6)
- # conjure (9)
- # core-async (41)
- # cursive (7)
- # data-science (7)
- # datomic (11)
- # events (1)
- # figwheel-main (4)
- # fulcro (20)
- # ghostwheel (9)
- # graalvm (18)
- # helix (46)
- # leiningen (14)
- # observability (2)
- # off-topic (23)
- # pathom (4)
- # re-frame (5)
- # reitit (5)
- # rum (2)
- # shadow-cljs (32)
- # spacemacs (8)
- # specter (5)
- # sql (36)
- # timbre (3)
- # vim (15)
- # xtdb (2)
- # yada (2)
@lilactown I see you've put up a project template that demos using storybook with cljs, do you have any strong reason to use storybook over devcards or https://github.com/nubank/workspaces ? (other than storybook has a nice out-of-the-box ui)
link to your project https://github.com/Lokeh/storybook-cljs
workspaces is fine for developers, but it’s not nearly as good of an interface as a catalogue of components that e.g. a designer or PM could use
I can't seem to get fast refresh working, even manually. Even though I call r/refresh! I don't see updates.
I’ve run into this a few times, and the checklist I follow is:
1. have I correctly enabled the feature flag. {:helix/features {:fast-refresh true}}
2. have I injected the hook correctly by calling inject-hook!
at some top-level / before app start
3. do I have the correct version of react-refresh
for the version of react
I have installed in my project
@lilactown just to check, I shouldn't be calling (mount)
again right? Only refresh! now?
if you upgraded react to latest, make sure you bump react-refresh npm i react-refresh@latest
that’s the most common reason I run into issues with it just silently not refreshing
there should be some logging in refresh!
that reports the number of components that were refreshed
@lilactown Yeah, updatedFamilies is of length 1
/** @license React v16.13.1
* react-dom.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Okay, I'm certain I'm goodcurrent: helix$core$cljs_factory_$factory(varargs) vs before when it had my actual component name in
@dominicm if you use :define-feature-flag
it changes the var name of the component:
(if flag-define-factory?
(symbol (str display-name "-render-type"))
display-name)
but fast-refresh doesn’t take this into account:
~(when flag-fast-refresh?
`(when ^boolean goog/DEBUG
(when ~sig-sym
(~sig-sym ~display-name ~(string/join hooks)
nil ;; forceReset
nil)) ;; getCustomHooks
(register! ~display-name ~fully-qualified-name)))
@dominicm https://github.com/Lokeh/helix/commit/48ce213177f19e621e8eae81db22e9df7e26b967
per dominic’s feedback, I tried using transients instead of JS arrays for building the rows in the benchmark I linked a few days ago
my simple tests show no difference in perf, which is pretty good!
cljs.user> (simple-benchmark
[]
(s/build-data 1000)
10)
[], (s/build-data 1000), 10 runs, 7 msecs
cljs.user> (simple-benchmark
[]
(s/build-data-array 1000)
10)
[], (s/build-data-array 1000), 10 runs, 7 msecs
cljs.user> (simple-benchmark
[]
(s/build-data 10000)
10)
[], (s/build-data 10000), 10 runs, 67 msecs
(simple-benchmark
[]
(s/build-data-array 10000)
10)
[], (s/build-data-array 10000), 10 runs, 62 msecs
I just did a build report of the benchmark (which is admittedly small) and it looks like this:
| Resource | Optimized | Total % | JS | Source |
|---------------------------------------+-------------+----------+-------------+-------------|
| npm | react-dom | 117.7 KB | 45.15 % | 118.4 KB | 120.2 KB |
| jar | cljs/core.cljs | 101.9 KB | 39.09 % | 1.2 MB | 334.4 KB |
| jar | cljs_bean/core.cljs | 13.6 KB | 5.22 % | 75.0 KB | 21.0 KB |
| npm | react | 6.3 KB | 2.43 % | 6.4 KB | 7.0 KB |
| jar | helix/dom.cljc | 5.6 KB | 2.16 % | 7.7 KB | 1.7 KB |
| npm | scheduler | 4.3 KB | 1.66 % | 4.8 KB | 5.4 KB |
| | demo/main.cljs | 4.1 KB | 1.56 % | 13.7 KB | 3.2 KB |
| | demo/state.cljs | 3.1 KB | 1.19 % | 16.1 KB | 2.4 KB |
| jar | cljs_bean/from/cljs/core.cljs | 1.5 KB | 0.58 % | 11.9 KB | 5.9 KB |
| jar | goog/base.js | 500.0 B | 0.19 % | 139.3 KB | 139.3 KB |
| npm | object-assign | 461.0 B | 0.18 % | 955.0 B | 2.2 KB |
| | shadow/js.js | 451.0 B | 0.17 % | 2.5 KB | 2.5 KB |
| jar | helix/core.cljs | 319.0 B | 0.12 % | 10.1 KB | 4.7 KB |
| jar | goog/string/stringbuffer.js | 308.0 B | 0.12 % | 2.7 KB | 2.7 KB |
| jar | goog/object/object.js | 301.0 B | 0.12 % | 23.0 KB | 23.0 KB |
| jar | helix/hooks.cljc | 159.0 B | 0.06 % | 13.8 KB | 7.9 KB |
| jar | goog/string/internal.js | 40.0 B | 0.02 % | 12.5 KB | 12.5 KB |
@lilactown this is really helpful. is this output from shadow? itd make my week to know how to do this...