]> cat aescling's git repositories - mastodon.git/commit
Optimize makeGetStatus (#11211)
authorThibG <thib@sitedethib.com>
Sat, 29 Jun 2019 22:12:38 +0000 (00:12 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 29 Jun 2019 22:12:38 +0000 (00:12 +0200)
commitf895bf198470c1d4a0299b454433fdf1c35ee2b0
tree0f4bdfc8acc9edae5c8a6f753161d48b950ce32b
parentccc7fe3e1d04c7cabad916e4e57c7739743d5c91
Optimize makeGetStatus (#11211)

* Optimize makeGetStatus

Because `ImmutableList.filter` always returns a new object and `createSelector`
memoizes based on object identity, the selector returned by `makeGetStatus`
would *always* execute.

To avoid that, we wrap `getFilters` into a new memoizer that memoizes based on
deep equality, thus returning the same object as long as the filters haven't
changed, allowing the memoization of `makeGetStatus` to work.

Furthermore, we memoize the compiled regexs instead of recomputing them each
time the selector is called.

* Fix memoized result being cleared too often

* Make notifications use memoized getFiltersRegex
app/javascript/mastodon/actions/notifications.js
app/javascript/mastodon/selectors/index.js