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
One of the easiest things to mess up performance is forgetting to add the shallow argument to your selector function if you're using a .map() or .filter() call in there, or when you want to select multiple subtrees.
To make debugging this easy, we could allow opting-in to a "StrictMode" like setup. When running in StrictMode, only during local development, each selector function would internally execute twice and is expected to be consistent (= both runs should compare equal using the provided isEqual helper). If not, it's tried with a shallow comparison to see if that would lead to the correct result. If so, we can emit a console error which hints at the developer that they may be forgetting the shallow arg.
I implemented a quick and dirty proof of concept for this feature, and I think it's promising. Of course, this needs to be polished before it's ready to ship, but I think people will love it to build performant apps.
The text was updated successfully, but these errors were encountered:
One of the easiest things to mess up performance is forgetting to add the
shallow
argument to your selector function if you're using a.map()
or.filter()
call in there, or when you want to select multiple subtrees.To make debugging this easy, we could allow opting-in to a "StrictMode" like setup. When running in StrictMode, only during local development, each selector function would internally execute twice and is expected to be consistent (= both runs should compare equal using the provided isEqual helper). If not, it's tried with a
shallow
comparison to see if that would lead to the correct result. If so, we can emit a console error which hints at the developer that they may be forgetting theshallow
arg.I implemented a quick and dirty proof of concept for this feature, and I think it's promising. Of course, this needs to be polished before it's ready to ship, but I think people will love it to build performant apps.
The text was updated successfully, but these errors were encountered: