diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-01-05 13:32:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 13:32:29 +0100 |
commit | 7e9d5bdbb9125197afb5b3df69ce49a79451d697 (patch) | |
tree | 699978db446c584d0bac29d201c6a35dd5c85575 /app/javascript/flavours/glitch/selectors | |
parent | 3a94668d8709c2156758041cda61b6253a431d68 (diff) |
[Glitch] Fix unnecessary re-rendering of various components when typing in web UI (#2063)
Port 9620ee90be7e04b3616ce4b851abb63dbba7af7f 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>
Diffstat (limited to 'app/javascript/flavours/glitch/selectors')
-rw-r--r-- | app/javascript/flavours/glitch/selectors/index.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js index df46b58a8..83f8783d9 100644 --- a/app/javascript/flavours/glitch/selectors/index.js +++ b/app/javascript/flavours/glitch/selectors/index.js @@ -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) => { |