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

[entityAdapter] handle draft states in selectors #815

Merged

Conversation

phryneas
Copy link
Member

Closes #606.

@markerikson what are your thoughts on exporting createDraftSafeSelector?

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 19, 2020

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 043a743:

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

@markerikson
Copy link
Collaborator

That I could live with.

Y'know, I'm really starting to lose track of all the stuff we do export from RTK... :)

@phryneas
Copy link
Member Author

Note to self: export that thing and add that to the docs. Tomorrow :)

That TODO list for 1.5.0 is getting shorter and shorter though :)

@phryneas phryneas added this to the 1.5 milestone Nov 20, 2020
@phryneas
Copy link
Member Author

@markerikson any comments on the docs for this one? :)

Copy link
Member

@msutkowski msutkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I just have a couple questions on descriptions

# `createDraftSafeSelector`

Besides re-exporting `createSelector`, RTK also exports a wrapped version of `createSelector` named `createDraftSafeSelector` that allows you to create selectors that
can be used in the context of `createReducer` and `createSlice` reducers with mutable logic.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explicitly state extra reducers as well?


# `createDraftSafeSelector`

Besides re-exporting `createSelector`, RTK also exports a wrapped version of `createSelector` named `createDraftSafeSelector` that allows you to create selectors that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to explain what/why in regards to immer Drafts or link to what isDraftable even is? I think the description you have in the code would actually work well here for clarity.


# `createDraftSafeSelector`

Besides re-exporting `createSelector`, RTK also exports a wrapped version of `createSelector` named `createDraftSafeSelector` that allows you to create selectors that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✋ I would state the actual problem up front: why does createSelector have an issue in the first place? What problem does this solve? (something along the lines of "passing Immer draft values to a memoized reducer makes it think the inputs haven't changed, so it returns a stale result").

docs/api/createSelector.mdx Outdated Show resolved Hide resolved
@markerikson markerikson merged commit afa762d into reduxjs:v1.5.0-integration Nov 28, 2020
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.

3 participants