This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-30
Channels
- # architecture (10)
- # babashka (11)
- # beginners (12)
- # calva (7)
- # clojure (7)
- # clojure-europe (2)
- # clojure-norway (12)
- # clojure-spec (2)
- # events (7)
- # fulcro (3)
- # hyperfiddle (3)
- # instaparse (12)
- # lsp (2)
- # malli (3)
- # missionary (20)
- # music (1)
- # off-topic (18)
- # reitit (9)
- # releases (4)
- # squint (5)
- # xtdb (32)
Can I make e/server
ignores unserializable value and pass it to the outer e/client
?
(e/client
(uix/$ antd/Dropdown
{:menu {:items
(e/server
(e/for-by :entity/id
[entitiy (e/server (find-entities state/db))]
(e/client
{:label (uix/$ :div (e/server (:entity/id entity)))
:key id})))}}))
Here e/server
would complain about the React component in item's labels. I'd like to have the full db entity in server context when constructing the React component.You need move the for-by
to the client and fetch each entity individually within the for-by. Alternatively, build up a complete payload server-side, then loop over it on the client.
In Electric, the mounting of DOM elements is a side effect produced by calling the dom/xyz
constructors, which is why this would work if it were pure Electric code. In the case of UIx, it wants the return value of the for-by
, and produces no side-effects. Hence the return value of the for-by becomes important, and how it passes between client and server matters.
❤️ 1