[DataGrid] Restore reselect behavior#14410
Conversation
| const reselectCreateSelector = createSelectorCreator({ | ||
| memoize: lruMemoize, | ||
| memoizeOptions: { | ||
| maxSize: 1, | ||
| } | ||
| }); |
There was a problem hiding this comment.
Perf-wise lruMemoize stores its entries an an array, but as we use maxSize: 1 we could write a memoizer that keeps a single value in a variable instead. Don't think it's worth it enough to spend time on it however.
There was a problem hiding this comment.
Nevermind, they have a special case for maxSize 1.
|
Deploy preview: https://deploy-preview-14410--material-ui-x.netlify.app/ |
| memoize: lruMemoize, | ||
| memoizeOptions: { | ||
| maxSize: 1, | ||
| equalityCheck: Object.is, |
There was a problem hiding this comment.
NaN values were previously preventing memoization.
reselect@5 added a runtime dev check that caught this, though it wouldn't have happened if they had used Object.is in the first place (which is the only valid equality comparison operator in JS). Also their dev checks are quite expensive, the grid could feel slower in dev mode.
Not the first time I find questionable decisions in reselect.
There was a problem hiding this comment.
Do you think it makes sense to replace reselect with our own composable selectors implementation?
There was a problem hiding this comment.
Would be nice but I'd place it as low priority, I don't think it would have a big impact on perf or bundle size.
cherniavskii
left a comment
There was a problem hiding this comment.
Thanks for taking care of it!
Follow-up of #11367 (comment)