Fixed: Speed up UI during refresh

Don't update state if we know items are equal to avoid reselections.
Don't pass LastInfoUpdate to frontend to prevent useless updates (the
field isn't used)
This commit is contained in:
ta264
2019-12-19 21:29:15 +00:00
committed by Qstick
parent 5b07046396
commit 959b8ed83e
4 changed files with 30 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import { createSelector } from 'reselect';
import createDeepEqualSelector from './createDeepEqualSelector';
import { createSelector, createSelectorCreator, defaultMemoize } from 'reselect';
import createClientSideCollectionSelector from './createClientSideCollectionSelector';
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
function createUnoptimizedSelector(uiSection) {
return createSelector(
@@ -26,8 +26,17 @@ function createUnoptimizedSelector(uiSection) {
);
}
function movieListEqual(a, b) {
return hasDifferentItemsOrOrder(a, b);
}
const createMovieEqualSelector = createSelectorCreator(
defaultMemoize,
movieListEqual
);
function createMovieClientSideCollectionItemsSelector(uiSection) {
return createDeepEqualSelector(
return createMovieEqualSelector(
createUnoptimizedSelector(uiSection),
(movies) => movies
);