[Glitch] Fix unnecessary re-rendering of various components when typing in web UI (#2063)
Port 9620ee90be
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import escapeTextContentForBrowser from 'escape-html';
|
||||
import { createSelector } from 'reselect';
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import { List as ImmutableList, Map as ImmutableMap, is } from 'immutable';
|
||||
import { toServerSideType } from 'flavours/glitch/utils/filters';
|
||||
import { me } from 'flavours/glitch/initial_state';
|
||||
|
||||
@ -74,6 +74,16 @@ export const makeGetStatus = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const makeGetPictureInPicture = () => {
|
||||
return createSelector([
|
||||
(state, { id }) => state.get('picture_in_picture').statusId === id,
|
||||
(state) => state.getIn(['meta', 'layout']) !== 'mobile',
|
||||
], (inUse, available) => ImmutableMap({
|
||||
inUse: inUse && available,
|
||||
available,
|
||||
}));
|
||||
};
|
||||
|
||||
const getAlertsBase = state => state.get('alerts');
|
||||
|
||||
export const getAlerts = createSelector([getAlertsBase], (base) => {
|
||||
|
Reference in New Issue
Block a user