Skip to content

Commit

Permalink
Don't construct new objects in selector inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Dec 18, 2023
1 parent 825f807 commit 8c02541
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/state/selectors/companionWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ const getCompanionWindowIdsOfWindow = createSelector(
export const getCompanionWindowsForPosition = createSelector(
[
getCompanionWindowsOfWindow,
(state, { position }) => ({ position }),
(state, { position }) => (position),
],
(companionWindows, { position }) => companionWindows[position] || EMPTY_ARRAY,
(companionWindows, position) => companionWindows[position] || EMPTY_ARRAY,
);

/**
Expand All @@ -113,9 +113,9 @@ export const getCompanionWindowsForPosition = createSelector(
export const getCompanionWindowsForContent = createSelector(
[
getCompanionWindowsOfWindow,
(state, { content }) => ({ content }),
(state, { content }) => (content),
],
(companionWindows, { content }) => (
(companionWindows, content) => (
[].concat(...Object.values(companionWindows)).filter(w => w.content === content)
),
);
Expand All @@ -126,9 +126,9 @@ const EMPTY_ARRAY = [];
export const getCompanionWindowIdsForPosition = createSelector(
[
getCompanionWindowIdsOfWindow,
(state, { position }) => ({ position }),
(state, { position }) => (position),
],
(companionWindowIds, { position }) => companionWindowIds[position] || EMPTY_ARRAY,
(companionWindowIds, position) => companionWindowIds[position] || EMPTY_ARRAY,
);

/**
Expand Down

0 comments on commit 8c02541

Please sign in to comment.