This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-02
Channels
- # announcements (4)
- # aws (18)
- # beginners (227)
- # boot (1)
- # calva (13)
- # cider (22)
- # clara (2)
- # cljs-dev (17)
- # clojure (85)
- # clojure-brasil (2)
- # clojure-dev (55)
- # clojure-europe (2)
- # clojure-italy (18)
- # clojure-japan (4)
- # clojure-losangeles (1)
- # clojure-nl (5)
- # clojure-uk (53)
- # clojurescript (46)
- # clojureverse-ops (8)
- # cursive (17)
- # data-science (3)
- # datascript (3)
- # datomic (25)
- # duct (4)
- # emacs (2)
- # figwheel-main (1)
- # fulcro (9)
- # hoplon (2)
- # hyperfiddle (1)
- # jobs-discuss (5)
- # kaocha (7)
- # leiningen (3)
- # nrepl (50)
- # off-topic (32)
- # portland-or (1)
- # re-frame (19)
- # reitit (2)
- # shadow-cljs (30)
- # spacemacs (2)
- # sql (8)
- # tools-deps (4)
- # vim (26)
- # xtdb (3)
- # yada (8)
hi guys,
I have a simple cell grid (say 100 * 100) using a <table>
which I want to change and update say every 50ms. So I trigger an event every 50ms which updates the grid.
It seems to me that I can't get this rate of animation. It's slowed down. relevant code:
(ns ant.views
(:require
[re-frame.core :as re-frame]
[ant.subs :as subs]
[ant.events :as ev]
))
(defn main-panel []
(let [grid (re-frame/subscribe [::subs/grid])]
(into [:table {:style {:border "1px solid red"}}]
(for [row @grid]
(into [:tr]
(for [cell row]
[:td {:width "5px" :height "5px"
:style {:backgroundColor (if (= cell 1) "black" "white")}}]))))))
(defn dispatch-timer-event
[]
(let [now (js/Date.)]
(re-frame/dispatch [::ev/timer now])))
(defonce do-timer (js/setInterval dispatch-timer-event 50))
::subs/grid
returns a vector of vectors with dimensions 100*100.
What can I do to improve performance in such a case? Should I drop re-frame event flow and just manipulate js directly?It might be related to https://github.com/Day8/re-frame/blob/5db2c159a8d42f5a53bb83e84fccba93b54a0ec7/docs/Performance-Problems.md#2--on-big-structures
Side note: js/setInterval
can be moved to effect. https://github.com/Day8/re-frame/blob/master/docs/FAQs/PollADatabaseEvery60.md
Or something like https://github.com/district0x/re-frame-interval-fx/blob/master/src/district0x/re_frame/interval_fx.cljs
Hello guys, i'm at situation which has multiple dropdown menus which is depending on each other, so based on the option i select on dropdown#1 i load suitable data into dropdown#2, i was able to creating New model from this type of form, but Editing isn't straightforward, what do you guys suggest ?
Edit the dropdown menus with the data
suppose i have 2 dropdown menus and the second dropdown data depend on the first, when i select option from dd#1 i got data loaded into dd#2
now i have both selected data of dd#1 and dd#2
is it straightforward to load these values ad default with data for both dd#1 and dd#2
i always get dd#2 empty
because i need to select any values from dd#1 to get data loaded
i'm not sure if you got what i mean
got it guys
thanks
my code actually do it but there was a simple bug and i have fixed and everything works