You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
;; Don't care about nextstate here, we use forceUpdate
;; when only when state has changed anyway.
(let [old-argv ($ c :props.argv)
new-argv ($ nextprops :argv)
noargv (or (nil? old-argv) (nil? new-argv))]
(cond
(nil? f) (or noargv (not= old-argv new-argv))
noargv (.call f c c (get-argv c) (props-argv c nextprops))
:else (.call f c c old-argv new-argv))))))
the not= call on line 170 can throw. A minimal example of this is:
(= {:todos 1} (sorted-map 1 2))
This is being tracked in CLJ-2325. It only shows up when using custom types. I don't think it can occur in equality checks between the standard Clojure data structures. A similar issue will need to be raised in CLJS, once the approach to fix it is decided in CLJS.
In the meantime, I wonder if we should wrap not= calls here with a try/catch, returning false if it throws. I'm not sure what the performance impact of this is though?
An alternative approach is for developers to manually reset the key of the React component to force a component re-render.
The text was updated successfully, but these errors were encountered:
danielcompton
changed the title
ShouldComponentUpdate can throw an exception on not=
Handling ShouldComponentUpdate throwing an exception
Mar 8, 2018
In
reagent/src/reagent/impl/component.cljs
Lines 160 to 172 in 1e19d31
not=
call on line 170 can throw. A minimal example of this is:This is being tracked in CLJ-2325. It only shows up when using custom types. I don't think it can occur in equality checks between the standard Clojure data structures. A similar issue will need to be raised in CLJS, once the approach to fix it is decided in CLJS.
In the meantime, I wonder if we should wrap
not=
calls here with a try/catch, returning false if it throws. I'm not sure what the performance impact of this is though?An alternative approach is for developers to manually reset the key of the React component to force a component re-render.
The text was updated successfully, but these errors were encountered: