This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-28
Channels
- # adventofcode (2)
- # announcements (4)
- # babashka (34)
- # beginners (44)
- # biff (5)
- # calva (8)
- # cider (4)
- # clj-kondo (5)
- # clj-on-windows (5)
- # clojure (57)
- # clojure-art (1)
- # clojure-denmark (2)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-seattle (1)
- # clojure-uk (2)
- # clojurescript (20)
- # cursive (6)
- # datomic (1)
- # emacs (6)
- # events (5)
- # fulcro (22)
- # helix (5)
- # hyperfiddle (5)
- # jobs (1)
- # joyride (2)
- # lsp (8)
- # malli (8)
- # off-topic (30)
- # pathom (8)
- # pedestal (1)
- # portal (5)
- # proton (1)
- # rdf (2)
- # re-frame (4)
- # releases (1)
- # remote-jobs (1)
- # reveal (8)
- # xtdb (5)
a lot of fulcro depends on props tunneling right? how does this work with functional (hooks) components? I noticed ident-optimized-render seems to not be able to refresh these, but I would expect more stuff to not work..
so there's a use-fulcro
hook that defsc
calls, that overrides .setState
to the hooks equivalent
aha, (binding [fdn/*denormalize-time* 900000000]
has ~fixed the ident optimized renderer.. still not fully understanding it, it's like peering inside a mechanical watch
maybe it's expected that you call render!
before a transact!
explicitly in ui code? having trouble figuring out where it would go in the renderer code
So, ident-optimized-render should have no problem refreshing either kind of component IF it has an ident. Such components do get indexed, which is how IOR finds them. If binding denormalize time fixes something with respect to IOR, then there is a bug I’m not aware of.
That said: Don’t use IOR. Just use the defaults. IOR is almost never much of a win, and is sometimes a loss, and I don’t personally use it, and I doubt many others do, so it is also much less likely to stay debugged over time as React changes.
If you want to try to find/fix the bug, then I would accept a PR if you’ve actually take the time to make a repro case that very clearly demonstrates the problem, and a PR that very clearly and cleanly fixes it.
but no, there is no expectation that you call render…but it could be that you’re misunderstanding how to work with IOR…since it has additional transaction requirements
(see book)….the specific requirement is you have to include follow-on reads in a transact for any keys that change but are unrelated the the transacting component (are not the component or a child).
the only mention the book has of "follow-on reads" is that it used to be a thing, but I think you mean the :refresh
vector in transact. In which case yes, the props tunneling to derived components code is getting called properly in IOR, the new props just don't get rendered
I don't think I'm the only person using IOR. Keyframe is only fast with class components (unless you memoize everything) and I'm looking at @U051V5LLP’s https://github.com/matterandvoid-space/subscriptions/blob/7b231a0a763a55c6892edf20c208f40e17569f21/docs/fulcro.md#L131 which also uses IOR
Sorry, that doc is out of date I will have to update it. I'm now not using fulcro at all for rendering, just for state mgmt, remotes, transactions and form state. https://github.com/matterandvoid-space/todomvc-fulcro-subscriptions this repo has an example of how i'm using subscriptions with fulcro
Ah, if you use hooks a lot, then you do have an optimization problem at the React layer because of the lack of SCU. That is correct. I have not yet written a helper for the react way of doing this
Now, instead of using IOR, you could instead leverage useMemo (the hook) to cover expensive UI ops, and see if that is fast enough in practice. You can also dig into the implementation (in js) of React memo
and if it isn’t too crazy it might be relatively easy to add a wrapper for it, and make it an automatic part of defsc
At the moment, though, I do not recommend making every component a hooks component because of this. There are many components that do not need hooks, and they mix well. So you can treat old-style components as the optimization “breakpoints” in your UI
should IOR be considered deprecated then? Right now my compromise is the inverse of kf2, explicitly force root render when stuff doesn't work, but I will look into another way of rendering if IOR is unsupported. I should note that I have an extremely idiosyncratic use case here (game engine)
No, IOR isn’t deprecated, I just don’t recommend it. I don’t have time to debug and patch the hooks issue you describe. If you want to understand more of the internals so you can issue a PR I’d be glad to help you understand how it all works.
Is there a function such as (f CurrentUser)
=> [:component/id ::CurentUser]
for components with constant ident?
yes there is, #(comp/get-ident % {})