This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-17
Channels
- # adventofcode (2)
- # bangalore-clj (1)
- # beginners (45)
- # boot (26)
- # cljs-dev (8)
- # cljsrn (25)
- # clojure (41)
- # clojure-austin (2)
- # clojure-belgium (6)
- # clojure-mke (3)
- # clojure-russia (37)
- # clojure-sanfrancisco (3)
- # clojure-spec (57)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojurescript (27)
- # clr (1)
- # code-reviews (3)
- # core-async (1)
- # datascript (5)
- # datomic (19)
- # emacs (12)
- # hoplon (59)
- # lambdaisland (9)
- # lein-figwheel (3)
- # off-topic (4)
- # om (1)
- # onyx (51)
- # pedestal (1)
- # protorepl (2)
- # re-frame (12)
Hi! If I use path
interceptor, then in this event handler, I can not refer to keys other than the one specified by path
, right? If this is not right, how should I use (path :key-a) and at the same time refer to (:key-b db)?
When we change the value of (:key-a db)
, can we use the value of (:key-b db)
, if we use (path :key-a)
interceptor?
@cmal so, if you want to change only value of (:path1 (:path2 :db)) , and you don't need any other values from :db you are using path, for example you want to set visible to true (:visible (:window :db)) , and you dispatch [:visible true] , if you want something more from :db you are not using path 🙂
@andre Thanks. So I think the path interceptor is useful only if data in the path depends on nothing else in db.
Solved! I've moved the mount-root
window-width
, and on-window-resize
to views.cljs
and it works.
--- original question ---
Hi! I am adding an on-window-resize
event handler to my re-frame project. I looked to reagent's doc and found this: https://github.com/reagent-project/reagent-cookbook/blob/master/recipes/canvas-fills-div/README.md#step-3-add-an-atom-and-event-handler-for-tracking-the-size-of-the-window , which shows adding window-width
, on-window-resize
and (.addEventListener js/window "resize" on-window-resize)
to main
function. I've added them to the mount-root
function of re-frame-template
, then I want to refer to window-width
and on-window-resize
in views.cljs
. If I use [my-project.core]
or something similar in views.cljs
, it will show circular dependency detected
. What is the right way to do this? Thanks!
Had a lot of fun writing this widget over past few evenings. I learned a ton; cofx, :dispatch-later
, undo
(incredibly easy to integrate btw!), and how to use third party react components (take a look at flip-move in case you need to animate lists). Thanks for the support and great documentation!
(scroll down to the bottom of the post to see the demo)
@upgradingdave Oh, I love that, thanks. We will be having a close look at how you pulled this off, first thing Monday.