-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[entityAdapter] handle draft states in selectors #815
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
Conversation
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:
|
That I could live with. Y'know, I'm really starting to lose track of all the stuff we do export from RTK... :) |
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 :) |
@markerikson any comments on the docs for this one? :) |
There was a problem hiding this 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
docs/api/createSelector.mdx
Outdated
# `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. |
There was a problem hiding this comment.
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?
docs/api/createSelector.mdx
Outdated
|
||
# `createDraftSafeSelector` | ||
|
||
Besides re-exporting `createSelector`, RTK also exports a wrapped version of `createSelector` named `createDraftSafeSelector` that allows you to create selectors that |
There was a problem hiding this comment.
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.
docs/api/createSelector.mdx
Outdated
|
||
# `createDraftSafeSelector` | ||
|
||
Besides re-exporting `createSelector`, RTK also exports a wrapped version of `createSelector` named `createDraftSafeSelector` that allows you to create selectors that |
There was a problem hiding this comment.
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").
Closes #606.
@markerikson what are your thoughts on exporting
createDraftSafeSelector
?