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

experiment: additional arguments into selectState #990

Closed

Conversation

phryneas
Copy link
Member

@phryneas phryneas commented Apr 9, 2021

As requested by Daniel in chat.

It's not a lot of code, so it could be discussion-worthy.

Essentially, the idea is to be able to pass additional args into the selectors created by the entityAdapter.
Actually, this is currently already possible for everything except selectById due to how reselect works - but not supported by the types.

Example:

import { createEntityAdapter } from "@reduxjs/toolkit";

const adapter = createEntityAdapter();

export const { selectAll: getComponents } = adapter.getSelectors(
  // @ts-ignore
  (state, containerId) => state.page.containers[containerId].components
);

let components = adapter.getInitialState();
components = adapter.addOne(components, { id: 1, foo: "bar" });

const state = {
    page: {
      containers: [undefined, undefined, { components }]
    }
  };

//@ts-ignore
const x = getComponents(state, 2);

@netlify
Copy link

netlify bot commented Apr 9, 2021

Deploy preview for redux-starter-kit-docs ready!

Built with commit 3f094d3

https://deploy-preview-990--redux-starter-kit-docs.netlify.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 9, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3f094d3:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration

@markerikson
Copy link
Collaborator

Hmm. This still something that's necessary with Reselect 4.1?

@markerikson markerikson added this to the 1.9 milestone Jul 3, 2022
@phryneas phryneas changed the title eperiment: additional arguments into selectState experiment: additional arguments into selectState Jul 3, 2022
@phryneas phryneas requested a review from markerikson July 3, 2022 21:04
@markerikson markerikson changed the base branch from master to v1.9-integration August 21, 2022 22:17
@markerikson
Copy link
Collaborator

Eh, I don't feel this is critical for 1.9.

@markerikson markerikson removed this from the 1.9 milestone Aug 21, 2022
@markerikson markerikson deleted the branch reduxjs:v1.9-integration November 4, 2022 14:06
@markerikson markerikson closed this Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants