This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-30
Channels
- # aleph (1)
- # beginners (126)
- # cider (2)
- # clara (38)
- # cljsrn (2)
- # clojars (2)
- # clojure (49)
- # clojure-dev (31)
- # clojure-dusseldorf (1)
- # clojure-finland (1)
- # clojure-france (6)
- # clojure-italy (13)
- # clojure-nl (12)
- # clojure-russia (9)
- # clojure-sg (1)
- # clojure-spec (33)
- # clojure-uk (83)
- # clojurescript (206)
- # community-development (3)
- # core-async (40)
- # cursive (4)
- # datomic (7)
- # duct (21)
- # emacs (9)
- # fulcro (36)
- # funcool (2)
- # graphql (12)
- # instaparse (4)
- # jobs (4)
- # lumo (24)
- # mount (1)
- # nyc (4)
- # off-topic (29)
- # onyx (1)
- # pedestal (2)
- # random (4)
- # re-frame (60)
- # reagent (136)
- # remote-jobs (1)
- # schema (1)
- # shadow-cljs (20)
- # spacemacs (6)
- # specter (14)
- # tools-deps (2)
@thheller see https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md for example applications
@alex-dixon Sorry, that's not a problem (infinite loop) we've seen reported previously. So no good suggestion. @danielcompton any ideas?
@colindresj nothing available for clearing a cached sub. :-)
@colindresj why do you want to clear a single cached sub? I can't think of any use cases for that that fit within the re-frame 'canon'
It might not fit within re-frameās canon š
I reverted reagent to 0.7.0 but kept 10x at latest and Iām still seeing the first warning posted above only when in popped out mode
Although not official and probably discouraged, wouldnāt calling dispose!
on a sub and swapping it out of re-frame.subs/query->reaction
effectively bust a single sub @mikethompson @danielcompton?
@alex-dixon can you post a small reproducible project with an issue? The only time I saw infinite loops was early on in 10x development when we used the same reagent as the host app, can't think what would be causing it now.
Also this is intended behaviour: > Also when I refresh the page when itās popped out it seems to disconnectā¦.shows āHost window has closed. Reopen external window to continue tracing. cause the JS vm has closed. It is meant to reconnect when the page loads again, so you should only see it briefly when reloading. It sounds like this wasn't happening for you?
Unfortunately no. Also ārendered by another copy of Reactā is the warning I was still getting with 0.3.1 after downgrading reagent from 0.8.1 to 0.7.0.
Yeah that would probably happen if you don't have the matching version of React/Reagent
It's a little bit messy because of the Reagent 0.7 -> 0.8/React 15->16 transition
We would have liked to only support React 16/Reagent 0.8, but it was in beta for quite a while so we have dual release branches for both
We'll probably drop support for 0.7 when we next do significant work on 10x, it's caused no end of confusion for people
It seemed mranderson depended on a 0.8.0 prerelease. Didnāt investigate if that included React 16 by default. I know 0.8.1 does
Think I saw it using 0.3.1-react16
Iām using the re-com/modal-panel
ā¦ and I want to add a scroller to the contents but wrapping the :child
in a scroller aināt working. Anybody done this before and know the magic or do I have to resort to lower level code?
Situation?
Other than it being a test?
Is the dispatch happening via :dispatch
?
Ie. an effect?
So, you are doing integration tests?
so what Iām trying to test is whether that dispatch is being called with the correct params
Hmm. You can easily enough stub out the event handler
and check the contents of the event in there
a simple example
(defn some-component
[]
[:a {:on-click #(rf/dispatch [:some-event "hello"])} "Hey"])
;; and then
(deftest a-component
(testing "So I'm trying to test that on-click here somehow"
(with-redefs [rf/subscribe (fn [action] (println action "here")
action)]
(let [fn (-> (some-component) second :on-click)]
(is (= (fn) "hello"))))))
yep, with-redefs
was going to be my next suggestion
(deftest my-test
(rf-test/run-test-sync
;; stub out the event handler
(rf/reg-event-db
:my-event
(fn [db v] .... check v in here)
Now test
@raymcdermott, it shouldn't require low level code, assuming you just want to do the basics and scroll the modal contents (rather than the entire modal panel).
The modal-panel is designed to shrink and grow horizontally and vertically based on the size of its content, so you can add 10 pages of text and it will just end up disappearing off the bottom of the page.
I'm assuming you want a vertical scrollbar here. To get that you have to limit the height of your content.
In the modal-panel demo, we have a modal here: https://github.com/Day8/re-com/blob/master/src/re_demo/modal_panel.cljs#L123
If you were to wrap the child so it looked like this:
[modal-panel
:backdrop-color "grey"
:backdrop-opacity 0.4
:style {:font-family "Consolas"}
:child [scroller
:height "200px"
:child [dialog-markup
form-data
process-ok
process-cancel]]]
You might tell me, "but I don't want it to be a specific height, I want it to kind of be based on the height of the browser window"
These will size according to the browser height, so you can set :max-height "85vh"
and it will keep the height of the modal panel no higher than 85% of the height of the browser window

These units are pretty widely available: https://caniuse.com/#feat=viewport-units