mirror of https://github.com/status-im/reagent.git
Compare all maps passed to components the same way
This commit is contained in:
parent
4c48271d26
commit
b6c20ac863
|
@ -231,15 +231,15 @@
|
||||||
[:code "atom"] ", the arguments passed to the component or
|
[:code "atom"] ", the arguments passed to the component or
|
||||||
component state."]
|
component state."]
|
||||||
|
|
||||||
[:p "All of these are checked for changes with a simple "
|
[:p "All of these are checked for changes with "
|
||||||
[:code "identical?"] " which is basically only a pointer
|
[:code "identical?"] " which is basically only a pointer
|
||||||
comparison, so the overhead is very low (even if the entries of
|
comparison, so the overhead is very low. Maps passed as arguments
|
||||||
the first argument, if it is a map, are compared separately, and "
|
to components are compared the same way: they are considered equal
|
||||||
[:code ":style"] " attributes are handled specially). Even the
|
if all their entries are identical. This also applies to built-in
|
||||||
built-in React components are handled the same way."]
|
React components like " [:code ":div"] ", " [:code ":p"] ", etc."]
|
||||||
|
|
||||||
[:p "All this means that you (hopefully) simply won’t have to care
|
[:p "All this means that you simply won’t have to care about
|
||||||
about performance most of the time. Just define your UI however you like
|
performance most of the time. Just define your UI however you like
|
||||||
– it will be fast enough."]
|
– it will be fast enough."]
|
||||||
|
|
||||||
[:p "There are a couple of situations that you might have to care
|
[:p "There are a couple of situations that you might have to care
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
(let [v' (v2 k)]
|
(let [v' (v2 k)]
|
||||||
(if (or (identical? v v')
|
(if (or (identical? v v')
|
||||||
(identical-ish? v v')
|
(identical-ish? v v')
|
||||||
(and (== 1 k)
|
(and (map? v)
|
||||||
(shallow-equal-maps v v')))
|
(shallow-equal-maps v v')))
|
||||||
res
|
res
|
||||||
(reduced false))))
|
(reduced false))))
|
||||||
|
|
Loading…
Reference in New Issue