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
{{ message }}
This repository has been archived by the owner on Feb 21, 2018. It is now read-only.
@pure currently does a shallow equal for prev/next props object and every first-level prop key.
This is a good and clear default which should be enough for the vast majority of performance issues, nevertheless in some cases we need to expand the shallow-equal check to specific sub-object keys.
ex taken from TextOverflow:
@pure
@props({popover: t.maybe(t.Object)...)}
In this case, as props.popover is an object created in the parent component, its ref will change at every render making @pure completely useless.
For component like TextOverflow which have a heavy render/componentDidUpdate computation we are willing to pay the extra shallow-equal check of props.popover to avoid useless re-renders
specs
TODO (this is a draft)
@pure should accept arguments
one optionalsettings argument
map key/integer where we define a custom depth level for a specific key
default is 0 (don't check children keys)
if key is not an object ignore it (maybe throw warning?)
what about arrays? should we ignore them for now?
misc
{optional: other useful info}
The text was updated successfully, but these errors were encountered:
requirements
@pure
currently does a shallow equal for prev/nextprops
object and every first-level prop key.This is a good and clear default which should be enough for the vast majority of performance issues, nevertheless in some cases we need to expand the shallow-equal check to specific sub-object keys.
ex taken from
TextOverflow
:In this case, as
props.popover
is an object created in the parent component, its ref will change at every render making@pure
completely useless.For component like
TextOverflow
which have a heavy render/componentDidUpdate computation we are willing to pay the extra shallow-equal check ofprops.popover
to avoid useless re-rendersspecs
TODO (this is a draft)
@pure
should accept argumentssettings
argument0
(don't check children keys)misc
{optional: other useful info}
The text was updated successfully, but these errors were encountered: