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

ComponentStore: Allow combining more than 4 selectors #2840

Closed
1 of 2 tasks
jaufgang opened this issue Dec 22, 2020 · 0 comments · Fixed by #2841
Closed
1 of 2 tasks

ComponentStore: Allow combining more than 4 selectors #2840

jaufgang opened this issue Dec 22, 2020 · 0 comments · Fixed by #2841

Comments

@jaufgang
Copy link

Please support combining of more than 4 selectors

@ngrx/store allows selecting up to 8 pieces of state with with the createSelector function. If Component Store supported 8 as well, it would be a huge improvement.

https://ngrx.io/guide/store/selectors#using-selectors-for-multiple-pieces-of-state

The createSelector function can take up to 8 selector functions for more complete state selections.

Describe any alternatives/workarounds you're currently using

Tediously nested selectors:

this.store
    .select(
      this.store.select(
        this.a$,
        this.b$,
        this.c$,
        this.d$,
        (a, b, c, d) => ({a, b, c, d}),
      ),
      this.store.select(
        this.e$,
        this.f$,
        this.g$,
        this.h$,
        (e, f, g, h) => ({e, f, g, h}),
      ),
      (abcd, efgh) => ({ ...abcd, ...efgh })
    ) //😢

If accepted, I would be willing to submit a PR for this feature

  • Yes (Assistance is provided if you need help submitting a pull request)
  • 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.

2 participants