This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-12
Channels
- # adventofcode (2)
- # aleph (2)
- # announcements (5)
- # aws (5)
- # babashka (25)
- # beginners (167)
- # calva (8)
- # cider (1)
- # clj-kondo (3)
- # cljsrn (19)
- # clojure (87)
- # clojure-conj (7)
- # clojure-dev (19)
- # clojure-europe (1)
- # clojure-italy (14)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (18)
- # clojure-uk (29)
- # clojuredesign-podcast (3)
- # clojurescript (40)
- # clojurex (11)
- # core-async (13)
- # core-logic (2)
- # cursive (16)
- # data-science (4)
- # datascript (10)
- # datomic (53)
- # emacs (1)
- # events (15)
- # fulcro (71)
- # jobs (1)
- # jvm (2)
- # malli (4)
- # nrepl (2)
- # pathom (74)
- # re-frame (1)
- # reitit (19)
- # remote-jobs (1)
- # rewrite-clj (18)
- # ring (2)
- # shadow-cljs (132)
- # spacemacs (22)
- # tools-deps (65)
@tony.kay did you experiment with react hooks a while back? I vaguely remember a use-fulcro
something? was that something you actually implemented?
It would not be terribly hard to do, I just have no personal need for it, and have other things I am trying to get done đ
yeah no worries. just thought I could maybe use it to figure out how to get my vdom stuff play nice with fulcro đ
If I remember right, you have no need of Fulcro controlling targeted refresh, right? Your macros kind of figure out what can change and auto-target it?
I have most of the vdom stuff figured out and working. not ready for public use but working.
A wealth of unusual words to take from there, âcopseâ, âwealdâ, âthicketâ.
I have some basic db normalization working too but I'd much rather not re-invent all that stuff and just let fulcro do it đ
There really isnât a lot to it. The ident-optimized render algorithm would be pretty much unchanged, except you would not call Reactâs setProps
, but would instead trigger whatever your equivalent is for refreshing a component.
the indexes need to be built for the on-screen components by a componentDidMount equivalentâŚsee defsc code for what that looks likeâŚ
Glad to integrate any level of âplug-inâ support you need to make it easy to select as an option. I guess to make it seamless weâd have to figure out how to get the defsc
code generation working rightâŚbut I think thatâs mostly in the configure-component!
function now, so it would actually probably be pretty easyâŚjust macro madness in terms of making sure the âhookâ is configured before anything compiles.
(defc ui-root [props state]
[query
(app/query [::filtered-todos
::editing
::num-total
::num-active
::num-completed])
(defc todo-item [{:keys [todo]} state]
[{::keys [completed? editing? todo-text]}
(app/query todo [::todo-text
::editing?
::completed?])
btw one thing I experimented with is creating a TransactedData
type that basically acts like a map and delegates to the actual state
cool..interested to see where that goes.
So, if I were tring to set up Fulcro with an alt rendering system, hereâs what Iâd do:
1. Iâd make some way to configure which function is used by defsc instead of the hard-coded configure-component!
2. Iâd figure out something similar for setting the function to call instead of setProps
in ident-optimized render
Thereâs already a way to set what function is root-render!
.
Then you should be able to make something that works with unmodified Fulcro apps (but either ignores or implements the lifecycle methods, of course).
components just need to be able to return their options map (see component-options
) for all of the core algs in Fulcro itself.
I doubt that unmodified fulcro apps can ever work. actually quite a few differences from react
so unlikely defsc
is gonna work. thats why I asked about hooks, that is much closer to what I have
So, Fulcro wants to render once from root, then is happy to have you control what renders afterwards.
but not sure why you think that unmodified Fulcro would not work (again, assuming you donât use lifecycle methods)
Fulcro does the root-level query, makes the props, passes it to the âroot renderâ
except for hot code reload, which may call root-render with a âforceâ to force the UI to update
the ident-optimized render will also use root render if there is no ident on a component that needs refresh
Almost everything in Fulcro will work if your component sets up enough stuff to respond properly to the component-options
method (I think youâd also have to make it so that things like react-component?
return trueâŚbut yes, see where the code takes you. The component-options
support (the open map of options) is critical for most of the compat.
But thereâs almost nothing special about React, and I canât think of any reason why almost any approach wouldnât work for rendering
but since js functions can have things just set on them, that should all be pretty easy
This might also help: http://book.fulcrologic.com/fulcro3/#_ui_refresh
The ârefresh by UI keywordâ requires the index from class->component
(on-screen component), which is constructed on the fly by React lifecycle normally.
@thheller I found the old code where I was playing with hooksâŚnot sure how useful it is, but here it is: https://github.com/fulcrologic/fulcro/blob/feature/react-play/src/main/play/main.cljs