This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (15)
- # announcements (3)
- # babashka (38)
- # beginners (121)
- # calva (29)
- # cider (21)
- # circleci (1)
- # clojure (177)
- # clojure-europe (7)
- # clojure-france (2)
- # clojure-nl (7)
- # clojure-spec (3)
- # clojure-switzerland (5)
- # clojure-uk (4)
- # clojurescript (10)
- # code-reviews (1)
- # conjure (19)
- # crux (99)
- # deps-new (2)
- # emacs (5)
- # fulcro (52)
- # graalvm (13)
- # kaocha (1)
- # malli (1)
- # off-topic (6)
- # pathom (5)
- # re-frame (17)
- # reagent (14)
- # remote-jobs (1)
- # rewrite-clj (5)
- # robots (1)
- # shadow-cljs (13)
- # sql (38)
- # tools-deps (16)
Hey guys, I couldn't find a way to programmatically change the url of the page from an effect handler, I'm sure there might be an easy way... anyone knows?
bidi for routing)
[answer in thread please]
It's right there in the
pushy documentation: https://github.com/kibu-australia/pushy#routing-libraries
The "Bidi" section has a
set-page! function - just call it within an effect.
Thank you @U2FRKM4TW I am using the db to store the current route. When I try to change the route, it correctly displays the corresponding panel, but it won't change the url.
I believe I have to use
set-token! to change the url (see https://github.com/kibu-australia/pushy#googhistoryhtml5history-methods) but I can't add an event to control it since it would create a circular reference.
I've seen this implementation (https://github.com/MattiNieminen/re-fill/blob/master/src/re_fill/routing.cljs) that saves the pushy instance into the db itself making it accessible from any event, eliminating the circular reference. I have to try it.
Actually, thank you so much @U2FRKM4TW, looking at kee-frame's code I found how they did it! (and it's pretty simple actually)
(rf/reg-fx :navigate-to goto)
tl;dr; With such an unqualified event ID we don't have to worry about the circular reference issue anymore.
(defn goto [data] (navigate! @state/navigator (url data)))
You don't have to worry about circular dependencies with fully qualified keywords as well - you can just avoid using an alias and instead spell out the whole keyword with its namespace.
A fully qualified keyword gives me a compilation error:
Did I write it wrong?
68 | [:dispatch [::spui.routes/navigate-to route]]]})) ------------------------------------------------------^------------------------- spui/events.cljs [line 68, col 48] Invalid keyword: ::spui.routes/navigate-to.
(re-frame/reg-event-fx ::navigate-to navigate-to)
:spui.routes/navigate-to instead of
::spui.routes/navigate-to (single colon).
Double colon expects a namespace alias.
does re-frame-10x work with reagent 1.0.0? I'm not sure whether there's something wrong with my config or whether it's a versioning problem - it seems like when i recompile, the page occasionally fails to load
I have an action I’d like to take when two different things (an API access token and a GPS location) become available in my app db. This would be easy enough if it was a component—I would simply have the component subscribe to both app db keys and everything would be good. But in this case, the action has no user-visible effects (it simply adds more information to the app db by talking to the API). So I’m looking for something like “fire an event when these two events have fired”. Suggestions gratefully received!
If it's indeed "if seen eventA and eventB, fire eventC", then you can use https://github.com/day8/re-frame-async-flow-fx If it's "when valueA and valueB are set, fire eventC", then you can use a global interceptor.
Thanks! My situation is more like: • If eventA is fired, and valueB is already in the app db, go ahead (using valueB in the handling of eventA). • If eventA is fired, but valueB isn’t (yet) in the app db, wait until it is and then handle eventA. (if that makes sense?)