Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store: Use createSelector with a dictionary of selectors #3677

Closed
1 of 2 tasks
markostanimirovic opened this issue Nov 27, 2022 · 0 comments · Fixed by #3703
Closed
1 of 2 tasks

Store: Use createSelector with a dictionary of selectors #3677

markostanimirovic opened this issue Nov 27, 2022 · 0 comments · Fixed by #3703

Comments

@markostanimirovic
Copy link
Member

Which @ngrx/* package(s) are relevant/related to the feature request?

store

Information

Provide the ability to use the createSelector function with a dictionary of selectors. This signature would remove repetitive code when creating view model selectors:

// BEFORE:
export const selectUsersPageViewModel = createSelector(
  selectUsers,
  selectActiveUser,
  selectQuery,
  selectIsLoading,
  (users, activeUser, query, isLoading) => ({
    users,
    activeUsers,
    query,
    isLoading,
  })
);

// AFTER:
export const selectUsersPageViewModel = createSelector({
  users: selectUsers,
  activeUser: selectActiveUser,
  query: selectQuery,
  isLoading: selectIsLoading,
});

Recently, we added a similar feature to the ComponentStore.select method (#3624).


Related discussion: #3650

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant