This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-03
Channels
- # announcements (3)
- # asami (4)
- # aws (1)
- # babashka (22)
- # beginners (111)
- # calva (3)
- # cider (1)
- # clj-kondo (55)
- # clj-on-windows (9)
- # cljsrn (1)
- # clojure (13)
- # clojure-europe (35)
- # clojure-losangeles (3)
- # clojure-nl (2)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (5)
- # clojurescript (51)
- # conjure (5)
- # cursive (5)
- # datascript (1)
- # datomic (27)
- # deps-new (8)
- # depstar (41)
- # emacs (4)
- # fulcro (24)
- # graphql (4)
- # gratitude (8)
- # helix (36)
- # jobs (2)
- # leiningen (2)
- # lsp (11)
- # off-topic (24)
- # pathom (23)
- # pedestal (2)
- # polylith (27)
- # re-frame (12)
- # reagent (7)
- # reitit (1)
- # releases (3)
- # remote-jobs (1)
- # rewrite-clj (4)
- # sci (1)
- # shadow-cljs (27)
- # spacemacs (12)
- # tools-deps (31)
- # web-security (2)
Hey @lilactown, thanks for the library! We're building our new app on helix and loving it so far. Something I've been wondering about a bit is if helix and the component macro + hook wrappers could allow for exposing more info around re-renders triggered by hooks. Unless I'm unaware of some new tools, this has been a major pain point in optimizing vanilla js(x) react components. My understanding is that the way react has implemented hooks fundamentally is at odds with surfacing this info via the debugger. Any thoughts on if it would be useful, and if so, how hard to expose this type of info. For example, if you could pass a meta data flag and handler to a component which is called with component name and hook name that returned a new value.
i.e. "this render was triggered by this specific use-state
hook by calling set-state
with arguments xyz
"?
I guess if you just want to know what values have changed, you could use something like https://github.com/clj-commons/spyscope
yes @lilactown, that is the "want". Checking out spyscope now
anyway, I could imagine a macro or something similar to what these provide but only logs things when values change from previous
if you do it as a macro or reader tag, you can use the ns+line as the identity to trace things across renders
In part, I think it's just something you could do with cljs and not js so would be fun to show
sure thing. I'm inspired. would be interested in something like this for my own debugging purposes
It's not a blocker or anything, just curious if there was an explicit reason to disallow
actually, backing up, because I was thinking of use-memo
and use-effect
: you're finding you can't pass in a var to use-callback
? i.e.
(use-callback
:once
some-fn)
doesn't work?--------------------------------------------------------------------------------
183 |
184 | search-terms (get query-params :search-terms "")
185 |
186 | _ (hooks/use-callback
-----------------^--------------------------------------------------------------
Got a single symbol update-query-params as a body, expected an expression. Maybe you meant (update-query-params)?
--------------------------------------------------------------------------------
187 | []
188 | update-query-params)
189 |
190 | debounce-time 325
--------------------------------------------------------------------------------
I just published helix 0.1.2 with the following:
Fixed
• Fix invalid hooks check false warnings when a `use-` symbol appears in a quoted form (@SevereOverfl0w)
• Allow a single var/binding to be passed to `use-callback`
Added
• Invalid hooks check now happens in `defhook` forms
• fnc
 for constructing anonymous components
https://github.com/lilactown/helix/blob/master/CHANGELOG.md