This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-12
Channels
- # adventofcode (1)
- # announcements (1)
- # atom-editor (4)
- # aws (4)
- # babashka (7)
- # beginners (46)
- # biff (14)
- # calva (11)
- # cljdoc (2)
- # clojure (78)
- # clojure-art (1)
- # clojure-austin (1)
- # clojure-europe (50)
- # clojure-nl (2)
- # clojure-norway (22)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (72)
- # conjure (6)
- # core-typed (6)
- # eastwood (4)
- # events (1)
- # figwheel-main (11)
- # fulcro (1)
- # guix (1)
- # helix (13)
- # jobs (2)
- # jobs-discuss (4)
- # kaocha (2)
- # malli (5)
- # off-topic (7)
- # pathom (22)
- # pedestal (9)
- # re-frame (29)
- # reagent (7)
- # releases (2)
- # remote-jobs (1)
- # rewrite-clj (12)
- # shadow-cljs (44)
- # sql (13)
- # squint (2)
- # xtdb (17)
I added day8.re-frame-10x
as described in the docs for shadow-cljs (https://github.com/day8/re-frame-10x#easy-setup) but when starting the application I get this error:
File: jar:file:/Users/$USER/.m2/repository/org/babashka/sci/0.2.8/sci-0.2.8.jar!/sci/impl/namespaces.cljc
failed to require macro-ns "sci.impl.namespaces", it was required by "sci.impl.namespaces"
Error in phase :compile-syntax-check
RuntimeException: No such var: edamame/normalize-opts
do I need to add something else?The error complains about babashka/sci/edamame - there's nothing about re-frame-10x in there. Are you absolutely sure it was just the dependency on re-frame-10x that triggered that error?
Adding
[borkdude/edamame "1.0.0"]
fixes it.This is the diff, without adding the borkdude/edamame I get the above error
maybe I need to put [day8.re-frame/tracing "0.6.2"]
also in project.clj
nope, by adding [day8.re-frame/tracing "0.6.2"]
instead of [borkdude/edamame "1.0.0"]
I get the same error
Maybe something else is configured wrongly, but don’t know, this works for now 🙂
I don’t see sci
or edamame
referenced in day8.re-frame/re-frame10x nor day8.re-frame/tracing
Ah, re-frame-10x depends on zprint which depends on sci. But in my case, sci explicitly depends on edamame, so not sure why it isn't the case for you, apparently.
Surely lein has some dependency tree tool that tells you which dependencies are included or excluded, and why - I'd try searching for examame there and see if something excludes it. Before you add it to your dependencies, of course.
Ah of course, did not think about that, I’ll check
thanks for digging already
this is one
[metosin/malli "0.2.1"]
[borkdude/dynaload "0.2.2"]
[borkdude/edamame "0.0.11-alpha.15"]
[org.clojure/test.check "1.1.0"]
Maybe Malli includes an earlier version that had no normalize-opts
in it for a long time
Is it safe to deref subscriptions in reagent/create-class/:get-initial-state
? I'm thinking yes it should be, right?
I have a very internal component that doesn’t know to much about other components, but the other components need to know when something happens inside the first one. is there a way to have multiple implementations (effects) to respond the just one event? or what strategy do you suggest to do that?
;;in the internal component
(reg-event-fx
:my-effect
(fn [{:keys [db]} [_]]
{:db (do-something-with-db)
:new-event db}))
;; first implementation in other component
(reg-fx
:new-event
(fn [db]
(do-something1))
;; second implementation in a third component
(reg-fx
:new-event
(fn [db]
(do-something2))
There is a way, but you're much better off by making that component explicitly pluggable in some sort. Basically, an observer pattern.
thanks @U2FRKM4TW you are always so helpful.
now I need to study about the observer pattern 🧑🎓
The easiest way here is to have a vector of functions in your app-db that that event handler needs to call. But not be the best way though - depends on the use case.
so I need some mechanism to register the functions that I need to call from the other components to the app-db, now when the :new-event is raised it could extract the functions from the db and call them…something like that?
Yep. Or it might be not in app-db but in some other place. But it might things more complex than needed - up to you.
I was also thinking in a callback fn as param as last resource
If the observers are not changing in run time, that's a good solution. Often, it helps making such low level components not depend on re-frame at all and just pass all the values and functions directly from parent components.
yes, that’s a good reason. thanks again @U2FRKM4TW I think I have all need to solve my issue now.