This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # arachne (1)
- # beginners (42)
- # boot (4)
- # cider (28)
- # clara (9)
- # cljs-dev (149)
- # cljsrn (5)
- # clojure (185)
- # clojure-austin (2)
- # clojure-dusseldorf (4)
- # clojure-italy (14)
- # clojure-norway (1)
- # clojure-russia (18)
- # clojure-spec (35)
- # clojure-uk (36)
- # clojurescript (78)
- # core-async (6)
- # data-science (20)
- # datomic (48)
- # emacs (1)
- # fulcro (2)
- # garden (4)
- # hoplon (47)
- # jobs (5)
- # jobs-rus (1)
- # leiningen (2)
- # lumo (12)
- # off-topic (8)
- # om (8)
- # onyx (39)
- # parinfer (19)
- # re-frame (100)
- # reagent (15)
- # ring-swagger (1)
- # sql (8)
- # vim (1)
- # yada (20)
I'm going through the re-frame TodoMVC example application https://github.com/Day8/re-frame/tree/develop/examples/todomvc
but cannot get it work.
It seems that app be properly initialized.
initialise-db event is dispatched at the very beginning: https://github.com/jumarko/re-frame/blob/master/examples/todomvc/src/todomvc/core.cljs#L49
However, after trying it run manually, I've found following error in JS console:
cofx handler is registered in
core.cljs:3679 No cofx handler registered for " :local-store-todos "
db.cljs, though: https://github.com/jumarko/re-frame/blob/master/examples/todomvc/src/todomvc/db.cljs#L78 If I try to register it manually, I got following error in cljs-repl (no error in browser console):
Any ides what might be wrong?
#object[TypeError TypeError: Cannot read property 'call' of undefined]
I also added following dependencies to :dev profile
:dependencies [[figwheel-sidecar "0.5.13"] [com.cemerick/piggieback "0.2.1"] ]
no, I use cider and
I'll also try
(use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl)
lein figwheelin a moment
And it also works with cider. My bad: I blidnly add most recent figwheel-sidecar version (0.5.13) but didn't noticed that todomvc uses 0.5.6 (of lein-figwheel)
Btw. any tips how to debug this type of problem? Let's say there's a real problem in re-frame's code handling
reg-cofx. How can I get something more useful than just
#object[TypeError TypeError: Cannot read property 'call' of undefined]?
Thanks. I think that error messages are usually great - e.g. "No cofx handler registered for " :local-store-todos " was really useful. Furthermore, thanks for the great project and fantastic documentation - it's a piece of art 🙂.
For me, coeffects (https://github.com/Day8/re-frame/blob/v0.10.1/docs/Coeffects.md) were/are a bit harder to grasp. I mean, it all makes sense, I just had to re-read the docs 🙂.
I was a bit confused by
inject-cofx - I expected that additional data will be automatically available in coeffects map without calling
inject-cofx in every handler. However, I think it all makes sense...
@mikethompson I should take a closer look at behavior trees. The thing I like about FSM here is that so many of us already understand them. It feels like a very intuitive model of computation, and I really think it resonates with people. Developers seem to like it.
Using FSM made UI development a lot less painful for me. But it was really the blend of FSM & Clojure’s rich data literals. The combination lets you create this model for your UI that is concise but so expressive — I love it!
And I’ve seen other devs use that technique, have that “aha” moment, then watch it bleed into the rest of their UI work, happily.
I got a question about reframe subscriptions. I am trying to work from the lein re-frame template. but when I wanted to modify the default db to contain something else then the :name i can not seem to subscribe to the new element. Even stranger even though I remove the the :name from the default db i can still subscribe to it. I was thinking that it was cached but even after multiple restarts i still have the same issue. Any hints on how I can solve this?
@jebberjeb I am very interested in using FSM for UI dev for the same reasons you are: Trying to get some clarity into UI dev. re-frame has helped in a huge way, and I think an FSM will make it even better. I’m particularly interested in state charts since they provide hierarchical/parallel states and history.
@newres i suggest installing the
re-frisk debugger and checking your
app-db with that
@mikethompson thanks for the pointer to behavior trees. They look interesting and I’m testing them now to see if they could fill my needs.
@jhund I’d be curious to see what you think of using state charts if you get a chance to. I’m wondering about the tradeoff in complexity vs the power they bring.
I’m considering a partial implementation of statecharts as per SCXML to keep it as simple as possible.
I know that Alan Shaw did a talk on it: https://www.youtube.com/watch?v=klqorRUPluw
I think you can get some of what state charts has to offer without actually using them. I think STD’s can be composed at least, without a lot of added complexity. That’s what I’m currently working on.
STD being considerably simpler, my thinking is to try and get as much mileage out of them as possible.
@sandbags I added re-frisk and suddenly the db is now in the proper state without me doing anything else.... Well I guess that solves the problem. Thanks!
@newres Had you restarted the app totally before? If not, my guess is that the restart to add re-frisk fixed the problem.
@deg I thought I have restarted before, did a lein clean as well, but it seems I must have missed something. It seems to work properly now, even if I change the db state.
@erichmond isn't that just url encoding? you can do that with the JS built-in functions
TLDR: Can reg-sub-raw contain a let with multiple reaction bindings, and then return a reaction that deref these? Not quite sure I can phrase this in a good way, but here goes: I’m trying to use reg-sub-raw to avoid some expensive computation to be re-run on every change to app-db. Examples in re-frame doc “SubscriptionFlow.md” wraps the entire subscription function in a reaction, but they don’t use app-db itself inside the computation, only subscriptions. In my case I utilise app-db, so my thinking was to use let bindings to create several reactions, and have the final reaction utilise these and hence only need to re-run when any of them change. Nothing seems to run when I do this, so I’m trying to clarify whether I do something wrong, or if my thinking is wrong altogether. Do I e.g. have to do like the examples, and have every dependency for the calculation as a separate subscription, avoiding deref of app-db itself?
one other stupid question. What is the way that people have mapped env vars to specific environments?
@erichmond on my last project, we did it by making an http call to the server to get back the config object as json in an initialization step.
@mokr are you aware of the difference between "Level 2" and "Level 3" subscriptions?
"Level 2" subscriptions extract data directly from
app-db (which is "root" of the signal graph, and known as Level 1).
Whereas "Level 3" subscriptions only have other subscriptions as input. They do not extract directly from
app-db. So Level 3 subscriptions represent "intermediate" nodes in the signal graph.
Level 3 nodes will only "rerun" (expensively?) if their "input subscriptions" change. Ie. the propagation of values through the signal graph is pruned back at Level 2 when it is found that there were no changes to the relevant parts of
app-db. The expensive "Level 3" work is not done unless it needs to be.
just found out that it's possible to put re-frame views in cljc files so that they can be used on Clojure as well 😮
does it mean that I could do quite a lot of work without even firing up clojurescript?
well that's dispatched on change of an input field anyway so I guess it would not be triggered anyway without the browser interaction
so does it mean I should use this as well to do some server side rendering of the html files?
@andrea.crotti there is a section at the very end on this ... https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md#server-side-rendering
hi, I want to have events that affect only one instance of a component, in Om land this was done with