Skip to content

Commit

Permalink
Disable reagent render/ratom queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Nov 28, 2024
1 parent 621fc81 commit f4bb778
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 37 deletions.
18 changes: 3 additions & 15 deletions src/reagent/impl/batching.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns reagent.impl.batching
(:refer-clojure :exclude [flush])
(:require [reagent.debug :refer-macros [assert-some]]
[reagent.impl.util :refer [is-client]]))
(:require [reagent.debug :refer-macros [assert-some]]))

;;; Update batching

Expand All @@ -10,19 +9,8 @@
(defn next-mount-count []
(set! mount-count (inc mount-count)))

(defn fake-raf [f]
(js/setTimeout f 16))

(def next-tick
(if-not is-client
fake-raf
(let [w js/window]
(.bind (or (.-requestAnimationFrame w)
(.-webkitRequestAnimationFrame w)
(.-mozRequestAnimationFrame w)
(.-msRequestAnimationFrame w)
fake-raf)
w))))
(defn next-tick [f]
(f))

(defn compare-mount-order
[^clj c1 ^clj c2]
Expand Down
22 changes: 3 additions & 19 deletions src/reagent/impl/template.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[clojure.string :as string]
[reagent.impl.util :as util :refer [named?]]
[reagent.impl.component :as comp]
[reagent.impl.input :as input]
[reagent.impl.protocols :as p]
[reagent.ratom :as ratom]
[reagent.debug :refer-macros [dev? warn]]
Expand Down Expand Up @@ -206,24 +205,9 @@
jsprops (or (convert-props (if hasprops props) parsed)
#js {})
first-child (+ first (if hasprops 1 0))]
(if (input/input-component? component)
(let [;; Also read :key from props map, because
;; input wrapper will not place the key in useful place.
react-key (util/get-react-key props)
input-class (or (.-reagentInput compiler)
(let [x (comp/create-class input/input-spec compiler)]
(set! (.-reagentInput compiler) x)
x))]
(p/as-element
compiler
(with-meta [input-class argv component jsprops first-child compiler]
(merge (when react-key
{:key react-key})
(meta argv)))))
(do
(when-some [key (-> (meta argv) util/get-react-key)]
(set! (.-key jsprops) key))
(p/make-element compiler argv component jsprops first-child)))))
(when-some [key (-> (meta argv) util/get-react-key)]
(set! (.-key jsprops) key))
(p/make-element compiler argv component jsprops first-child)))

(defn raw-element [comp argv compiler]
(let [props (nth argv 2 nil)
Expand Down
6 changes: 3 additions & 3 deletions src/reagent/ratom.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@

(defn- rea-enqueue [r]
(when (nil? rea-queue)
(set! rea-queue #js [])
(batch/schedule))
(.push rea-queue r))
(set! rea-queue #js []))
(.push rea-queue r)
(batch/schedule))

;;; Atom

Expand Down
1 change: 1 addition & 0 deletions test/reagenttest/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[reagent.debug :as debug]
[reagent.dom :as rdom]
[reagent.dom.server :as server]
[reagent.dom.client :as rdomc]
[reagent.impl.template :as tmpl]))

;; Should be only set for tests....
Expand Down

0 comments on commit f4bb778

Please sign in to comment.