Fork me on GitHub
#re-frame
<
2019-09-02
>
eag14:09:46

I'm getting an error from one an input field. I have no idea why. If I take the input field out, the error goes away. Even though I'm getting the error, it still actually works. The error is this:

react-dom.development.js:507 Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.
warningWithoutStack @ react-dom.development.js:507
unmountComponentAtNode @ react-dom.development.js:21174
day8$re_frame_10x$inlined_deps$reagent$v0v8v0$reagent$dom$unmount_comp @ dom.cljs:16
day8$re_frame_10x$inlined_deps$reagent$v0v8v0$reagent$dom$unmount_component_at_node @ dom.cljs:47
day8$re_frame_10x$inlined_deps$reagent$v0v8v0$reagent$core$unmount_component_at_node @ core.cljs:81
day8$re_frame_10x$events$open_debugger_window @ events.cljs:288
(anonymous) @ events.cljs:299
day8$re_frame_10x$inlined_deps$re_frame$v0v10v6$re_frame$std_interceptors$fx_handler__GT_interceptor_$_fx_handler_before @ std_interceptors.cljc:149
day8$re_frame_10x$inlined_deps$re_frame$v0v10v6$re_frame$interceptor$invoke_interceptor_fn @ interceptor.cljc:68
day8$re_frame_10x$inlined_deps$re_frame$v0v10v6$re_frame$interceptor$invoke_interceptors @ interceptor.cljc:106
day8$re_frame_10x$inlined_deps$re_frame$v0v10v6$re_frame$interceptor$execute @ interceptor.cljc:201
day8$re_frame_10x$inlined_deps$re_frame$v0v10v6$re_frame$events$handle @ events.cljc:65
(anonymous) @ router.cljc:179
(anonymous) @ router.cljc:198
(anonymous) @ router.cljc:146
(anonymous) @ router.cljc:169
(anonymous) @ router.cljc:187
channel.port1.onmessage @ nexttick.js:212
router.cljc:204 Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
 
And the offending component is this.
(defn input-product-level
  "Input a new product level"
  []
  (let [selected-qty (re-frame/subscribe [::subs/selected-qty])
        show-twirly (re-frame/subscribe [::subs/show-twirly])]
    (fn []
      [:div
       [:input {:type :number
                :value @selected-qty
                :on-change #(re-frame/dispatch [::events/qty-change (-> % .-target .-value)])}
        (when (some? @show-twirly) [throbber])]])))

eag15:09:54

Figured it out. The throbber was inside the input vector, not outside of it.