Fork me on GitHub
#re-frame
<
2018-07-30
>
zalky21:07:11

Hi all, was trying to create a dom element resize signal that other subscriptions could depend on. First stab was something along the lines of:

(r/after-render
 (fn each-render []
   (when (boolean @<-node)
     (let [n @<-node]
       (->> (.-offsetWidth n)
            (reset! <-size-signal))))
   (r/after-render each-render)))
Essentially this polls every animation frame and produces a signal for the element size. It's relatively simple, cheap and it works. But it appears to play havoc with re-frame-10x. re-frame-10x generates many thousands of traces (not sure why) and fails to update app state and subscription results. If you remove those lines of code, re-frame-10x behaves as expected. I'm wondering if: 1. I'm doing something incredibly obtuse with the recursive call to each-render. 2. Is this a bug in re-frame-10x? Is there a reason the above formulation might throw it so out of wack?