Skip to content

Commit

Permalink
Fix re-rendering in content scripts in Firefox extensions
Browse files Browse the repository at this point in the history
There is a problem with Reagent in content scripts in Firefox extensions where
the UI does not update when a ratom changes.

The problem is described here
NoxHarmonium@a9e898c
with Reagent 0.9.0+, though that Reagent fork also has a branch that patches
Reagent 0.8.1. The relevant branches are:
* fix-raf-binding-0.8.1
* fix-raf-binding-0.9.0-rc1
* master (with fix on 0.9.0)

Note the "related links section" of the commit message at the above link: React
issue facebook/react#16606
From what I’ve read, this only seems to affect content scripts in browser
extensions in Firefox.

I have merely applied the fix in the commit at the above link to Reagent 0.10.0.

[#170650669]
  • Loading branch information
spellman committed Mar 17, 2020
1 parent 84692f8 commit 4898a9e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/reagent/impl/batching.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
(def next-tick
(if-not is-client
fake-raf
(let [w js/window]
(or (.-requestAnimationFrame w)
(.-webkitRequestAnimationFrame w)
(.-mozRequestAnimationFrame w)
(.-msRequestAnimationFrame w)
fake-raf))))
(or (. (. js/window -requestAnimationFrame) bind js/window)
(. (. js/window -webkitRequestAnimationFrame) bind js/window)
(. (. js/window -mozRequestAnimationFrame) bind js/window)
(. (. js/window -msRequestAnimationFrame) bind js/window)
fake-raf)))

(defn compare-mount-order
[^clj c1 ^clj c2]
Expand Down

0 comments on commit 4898a9e

Please sign in to comment.