This repository has been archived by the owner on Jul 10, 2019. It is now read-only.
Equivalent to replaceReducer
?
#306
Labels
replaceReducer
?
#306
Hi,
I am currently trying to replace the use of redux in the Vulcan.js framework (built on top of Meteor) with apollo-link-state.
Meteor being package based, we used to allow people to register additional reducers to the centralized redux store. Internally, this feature relied on the Redux store
replaceReducer
.I am looking for an equivalent pattern with
apollo-link-state
. It means being able to add Mutation after the link is created. Let's call this functionaddMutation
for example.My first naive idea is to create a new link when the user call
addMutation
, and then instantiate a new client with this new link, but with keeping the old cache.However, it feels not very clean. In Redux, this would be equivalent to getting the current store state, creating a new store with up-to-date reducers, and rehydrating it with the previous state, instead of using
replaceReducer
.Edit: another solution is to defer the apollo client until all packages have registered their mutation in a central object. But still, a function like
replaceLinks
orreplaceStateLinkResolvers
in the client could be interesting for some advanced use cases.My question is: did I miss some helper I could use, and do you have a better pattern that would be equivalent to Redux store
replaceReducer
?Let me know if I should post this on StackOverflow instead, however since
apollo-link-state
seeks to be a replacement for Redux I thought my question belonged more here since replacing reducers is normal pattern in Redux.The text was updated successfully, but these errors were encountered: