Skip to content

Commit

Permalink
refactor: fix selector memoization warning (#5436)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski authored May 17, 2024
1 parent a58fbfd commit 527c03e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const TagForm = ({ systemId }: Props): JSX.Element | null => {
machineSelectors.getById(state, systemId)
);
const tags = useSelector((state: RootState) =>
tagSelectors.getByIDs(state, machine?.tags || [])
tagSelectors.getByIDs(state, machine?.tags || null)
);
const tagsLoading = useSelector(tagSelectors.loading);
const taggingMachines = useSelector(machineSelectors.updatingTags);
Expand Down
6 changes: 3 additions & 3 deletions src/app/store/subnet/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ const active = createSelector(
const getByIds = createSelector(
[
defaultSelectors.all,
(_state: RootState, ids: Subnet[SubnetMeta.PK][]) => ids,
(_state: RootState, ids: Subnet[SubnetMeta.PK][] | null) => ids,
],
(subnets, ids) => {
return subnets.filter(({ id }) => ids.includes(id));
(subnets, ids = []) => {
return subnets.filter(({ id }) => ids?.includes(id));
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const DHCPStatus = ({ id }: Props): JSX.Element | null => {
vlanSelectors.getById(state, id)
);
const vlanSubnets = useSelector((state: RootState) =>
subnetSelectors.getByIds(state, vlan?.subnet_ids || [])
subnetSelectors.getByIds(state, vlan?.subnet_ids || null)
);
const subnetsLoading = useSelector(subnetSelectors.loading);

Expand Down

0 comments on commit 527c03e

Please sign in to comment.