Skip to content

Commit

Permalink
fix: memoization
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Sep 15, 2023
1 parent a408d74 commit 86c6b72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/create-loader-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export function loaderTableSelectors<S = any>(

const selectById: any = createSelector(
selectTable,
(s: S, p: PropId) => p,
findById,
(_: S, p: PropId) => p.id,
(loaders, id) => findById(loaders, { id }),
);
const selectByIds: any = createSelector(
selectTable,
(s: S, p: PropIds) => p,
findByIds,
(_: S, p: PropIds) => p.ids,
(loaders, ids) => findByIds(loaders, { ids }),
);

return {
Expand Down
4 changes: 2 additions & 2 deletions src/create-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function tableSelectors<Entity extends AnyState = AnyState, S = any>(
selectById,
selectByIds: createSelector(
selectTable,
(s: S, p: PropIds) => p,
findByIds,
(_: S, p: PropIds) => p.ids,
(tbl, ids) => findByIds(tbl, { ids }),
) as any,
};
}
Expand Down

0 comments on commit 86c6b72

Please sign in to comment.