Migrating from apollo-link-state #1183
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
I am trying to migrate from
apollo-link-state, to fixdefaultstate not being set onssr.When this kit migrated to
apollo-client3.0 (#1134),defaultstate was not set onssr. Workaround for this was to set it in code and pass it to components manualy -> https://github.com/sysgears/apollo-universal-starter-kit/pull/1134/files#diff-1c960d0cc9e1d13dca0e9950e18e5f4eR25.Apollo docs, state that
apollo-link-stateis no longer needed and can be removed like this:https://www.apollographql.com/docs/react/v2.5/essentials/local-state/#migrating-from-apollo-link-state
It also states that
defaultsare no longer supported andcache.writeDatashould be used to set it.How did you fix it?
I followed the migration guide and removed
withClientStateand calledcache.writeData, to set default data, but it does not seem to work. Now even when code gets regenerated on client side, local state is not working.I
console.logprops.filteron/usersroute, to test this out.@larixer Could you please take a look what I am doing wrong and if you have any suggestions how to fix this?