Hi
Noob question here:
I cloned https://github.com/HumbleUI/HumbleUI, and run the example. Open the project in Cursive and connect to socket repl.
Problem: I can not get the ui to reload if I change something like a button text, and reevaluate (def ui... in the repl.
Also:
that’s because app is holding onto previous value. UIs are values in Humble UI. When you def new value, it only replaces this var, but doesn’t change any previous references
For this style to work, you need to re-define top-level app, too
notice how ui/window accepts either value, atom or var. In last two cases, this allows redefinition. When those are redefined, window will re-render (IIRC, automatically)
I understand, but not quite I think for I can't get it to reload
• I turn (def app.. into (defn create-app ... (line93)
• I turn line 120 into (reset! state/*app (create-app))
• Now I change something in the loaded example, and re-eval that def
• Now I eval (reset! state/*app (create-app))in the repl
I expect that should re-create the app, re-include the exaple and swap the atom that went into (ui/window. But, the change is not reloaded
Did you eval-ed change first?
In other words, are you sure that value that create-app returns contains new value of your component?
that's the question: I guess it depends on the (ui/dynamic) function. I added a println to create-app, and it prints each time I eval (reset! state/*app (create-app)) so that should be fine
(hope I don't bore you with this nooby stuff.., appreciate the help)
I once saw this video https://www.youtube.com/watch?v=qQvvgzvPgQI&pp=ygURY2xvanVyZSBzbWFsbHRhbGs%3D (clojure in smalltalk style) and I really like the way the smalltalk browser works and make your system discoverable. I would like tot try to build something like this in clojure and why not? in Humbleui
hmm, the ui definition in the example (button in this case) is not re-evaluated it seems.
I made this little test:
(def foo
;(ui/dynamic ctx [{:keys [leading]} ctx]
(ui/label
(do
(println "---execution!---")
(str "bar"))))
So when I eval this with the 'dynamic' wrapper commented, stuff is eval'ed. But with de 'dynamic' wrapper enabled, no evaluation. So that's why my changes won't come through.
(the ui val in button namespace is wrapped with dynamicIt actually should print when you re-eval def foo in both cases
(user/reload) now works well. Thanks!
(examples.state/reload)
Syntax error compiling at (REPL:2:1).
No such var: examples.state/reloadtry (user/reload)
When I do that, amazing things happen. • a fullscreen window opens showing the dependency graph exmaple (in full glory)
The existing app window changes into this:
Oops :)
Try removing incremental.clj and incremental_graph.clj
I guess reload loads them too
yeah, that did some good. The interesting effects are gone. then, for a moment I see the change I made in the example, and then after a second I get this screen, with a counter running up (Not an example I could find)
This is vdom.clj delete it too
I’m thinking on how to make them co-exist
Should be better now, should not require removing any files at least https://github.com/HumbleUI/HumbleUI/commit/c2e4fc996de8c4c48f4ed89f8cfbd0a46edca9f4
(user/reload) should work out-of-the box
If you use scripts/repl.py
yes! that works. well done!
What am I missing here?