-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add documentation for using with an immutable redux store #30
Comments
Thanks for sharing, @rblakemesser. |
@ryanashcraft I've been thinking about something since I started working with
If that's its scope, why does it impose its own entities reducer? Don't take me wrong, I'm ok with For now, what I'm doing is something like this: const mapDispatchToProps = { actionCreator }
const mapPropsToQuery = (props) => ({
url: `api/todos`,
// gets dispatched as soon as the requests completes
transform: props.actionCreator,
update: {} // required by redux-query
})
const enhance = compose(
connect(void 0, mapDispatchToProps),
connectRequest(mapPropsToQuery)
)
export default enhance(Component)
Where However, to roll back optimistic updates, I'd need to have my entities reducer react to the Even if this was added I feel like the code for updating entities (optimistically and otherwise) is too coupled to your implementation of the entities reducer. Both this issue and #34 display how cumbersome it can be to use your own reducers. I'd love to hear your thoughts on this :) |
@acontreras89 FYI the As far as it goes with the coupling between |
It took me a minute to get redux-query working with a redux-immutable store, so I thought I'd share. Apologies if this is the wrong venue.
Basically the lowest-surface area solution seemed to be to just wrap the provided redux-query reducers with some immutable serialization logic.
Define
reducers/entities.js
as:Then
reducers/queries.js
as:Then use your wrapped versions when you call combineReducers:
And of course, the middleware selector functions in
store.js
:It would be more efficient to have built-in immutable support, but absent that I was happy enough to just get it working.
The text was updated successfully, but these errors were encountered: