Comments (15)
@jbaxleyiii perhaps we should use lodash.assign
?
from react-apollo.
@jbaxleyiii Yes sure, thanks! Yes i am! When using the connect function it fails. Tries to deep copy state by using Object.assign which i believe doesn't work well with immutablejs. I also got some errors of wrong usage of Object.assign:
One of the sources for assign has an enumerable key on the prototype chain. This is an edge case that we do not support. This error is a performance optimization and not spec compliant.
I get this error by just using connect from apollo.
Dunno what needs to be done tho. Check if the state is immutable before assigning? not sure
from react-apollo.
changed from
var storeState = this.store.getState();
this.state = Object.assign({}, storeState)
to
var storeState = this.store.getState();
this.state = storeState.toJS()
And it started working again. Seems like an issue with Object.assign and react native, prooobably not related to this lib :))
from react-apollo.
@stubailo sounds good too me. I can change that out and open a PR this evening for it, unless you or someone else wants to get to it sooner?
Also, welcome back!
from react-apollo.
Hey good to be back! So relaxing :) I can try, but I have a lot of meetings so it might be much later today.
from react-apollo.
haha same here 👍
from react-apollo.
Does assign even work with immutable Map?
from react-apollo.
nvm.. The issue seems to be the use of immutable reducers.. Seems like react-apollo doesn't treat immutable data very well :)
from react-apollo.
@AlmaasAre can you show me your usage? I'd love to improve this lib to support immutable data! Are you using immutable.js?
from react-apollo.
@AlmaasAre yep! I need to add in a check for immutablejs 👍
from react-apollo.
Does it make more sense to provide a way for the user to map their storeState
to connect
's local state? If you just add a check for immutable.js you'll still have the same problem when users are using other immutable libraries.
Instead maybe connect
can accept a function like getStateFromStoreState
that passes in storeState
and lets the user parse and return a plain object representing their state.
from react-apollo.
Apollo Client now supports React Native as of 0.3.27! Going to close this issue because most of the conversation is about Immutable.js and not React Native.
from react-apollo.
I think that with the 0.5.25 version of apollo-client that uses object spread and polyfills with Object.assign, this bug came back..
In my implementation this happens on refetch
.
Also I think this issue belongs in apollo-client rather than here.
from react-apollo.
@davidyaha is this still the case for you with 0.7.1? If so, please open an issue on apollo-client! ❤️
from react-apollo.
Not sure.. I will update next week probably and if it reappears I'll open a new issue.
from react-apollo.
Related Issues (20)
- Cannot find module error 'apollo-client' after installing @apollo/react-testing inside a test
- useSubscription doesn't work for new windows
- Refetch or re-using lazy query make data incomplete.
- MockedProvider HOT 1
- useLazyQuery executed multiple times HOT 1
- FetchPolicy 'network-only' and 'no-cache' return cached value in Apollo Client v3 HOT 1
- Creating npm module that uses <Query> component without instantiating <ApolloProvider> in the module
- MockedProvider mocking `null` data HOT 1
- Can't perform state update on an unmounted component
- MockedProvider not working correctly HOT 1
- version 3.1.4 (and 3.1.5) breaks addMocksToSchema from @graphql-tools/mock
- [v3] Local state management
- Release notes
- Query with errorPolicy "all" cannot effectively use onError, onCompleted HOT 1
- @apollo/react-hooks changelog
- Breaking change in 3.1.5 in `useLazyQuery` HOT 1
- when status code is 403, client.query => graphqlError, graphql hoc => networkError HOT 2
- useQuery returning undefined
- Errors that occur in refetchQueries cannot be caught HOT 1
- useQuery with onCompleted: infinite loop.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-apollo.