This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-09
Channels
- # announcements (2)
- # babashka (33)
- # beginners (122)
- # bristol-clojurians (1)
- # calva (6)
- # chlorine-clover (3)
- # cider (45)
- # clara (10)
- # clj-kondo (3)
- # cljsrn (17)
- # clojure (80)
- # clojure-dev (21)
- # clojure-europe (86)
- # clojure-italy (5)
- # clojure-japan (5)
- # clojure-losangeles (7)
- # clojure-nl (5)
- # clojure-portugal (3)
- # clojure-uk (31)
- # clojurescript (30)
- # conjure (4)
- # core-async (29)
- # cursive (20)
- # data-science (25)
- # datomic (7)
- # duct (17)
- # figwheel-main (73)
- # fulcro (23)
- # jobs-discuss (36)
- # juxt (5)
- # kaocha (2)
- # lambdaisland (6)
- # luminus (5)
- # malli (17)
- # mount (10)
- # music (7)
- # off-topic (16)
- # re-frame (30)
- # ring (17)
- # rum (1)
- # shadow-cljs (10)
- # spacemacs (10)
- # specmonstah (4)
- # sql (45)
- # tools-deps (21)
- # xtdb (20)
I rebase many times a day, or switch branches, I seem to break my build whenever I do. I get weird errors, usually with broken JS output or similar. How can I resolve this?
do debounces go into a queue? They should wait for the previous build to finish, if they don't.
it runs on the assumption that the time between files changes is small and if it’s exceeded
yeah, I'm still reading it as not be a debounce. It basically just sleeps 50ms from the first event coming in.
I should double check my terminology, I know there's a distinction from debounce/throttle, but I forget repeatedly
yeah, this has 2 big bold definitions. This is a throttle: > Throttling enforces a maximum number of times a function can be called over time. As in “execute this function at most once every 100 milliseconds.” except 50ms
> Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in “execute this function only if 100 milliseconds have passed without it being called.” This is what you described
(defn throttle [millis f]
(fn [{:keys [collector] :as ctx} e]
(let [collector (or collector (atom {}))
{:keys [collecting? events]} (deref collector)]
(if collecting?
(swap! collector update :events (fnil conj []) e)
(let [events (volatile! nil)]
(swap! collector #(-> %
(assoc :collecting? true)
(update :events (fn [evts] (vreset! events evts) nil))))
(future
(f (cons e @events))
(Thread/sleep millis) ;; is this needed now?
(swap! collector assoc :collecting? false))))
(assoc ctx :collector collector))))
(defn throttle [millis f]
(fn [{:keys [collector] :as ctx} e]
(let [collector (or collector (atom {}))
{:keys [collecting? events]} (deref collector)]
(if collecting?
(swap! collector update :events (fnil conj []) e)
(let [events (volatile! nil)]
(swap! collector assoc :collecting? true)
(future
(try
(Thread/sleep millis) ;; is this needed now?
(swap! collector update :events (fn [evts] (vreset! events evts) nil))
(f (cons e @events))
(finally
(swap! collector assoc :collecting? false))))))
(assoc ctx :collector collector))))
ah, I see. And then any that come in during f will be collected and in the queue for later, great!
There's a lot of considerations to factor in this little function. State is really hard.
@admin055 I got rid of the dependency on create-react-class so that’s no longer a problem
@bhauman Perfect, thx for the information.
> Thanks for trying this out @admin055 > I really need this early feedback to work out the last bugs. Sorry I > didn’t try this with android. It’s such a large setup time. it's always a pleasure to use and test your work. I'll retry today later and let you know.
Thx @bhauman, all works perfect on Android emulator for me now.
For Android emulator and real devices, we must only do on more command: adb reverse tcp:9500 tcp:9500
to get access to:
Last night it was too late i didn't even think about that! :)
Android real device test checked ✔️
Yes of course
@bhauman > Would you want to add android notes to the react native figwheel docs? PR done. > also you may want to try the :launch-js configuration and see how it works? Work perfectly, nice work!