Skip to content
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

Upgrade React Apollo (new apollo client structure) #270

Closed
Sly777 opened this issue Nov 14, 2017 · 11 comments
Closed

Upgrade React Apollo (new apollo client structure) #270

Sly777 opened this issue Nov 14, 2017 · 11 comments

Comments

@Sly777
Copy link
Owner

Sly777 commented Nov 14, 2017

  • Upgrade React Apollo (new Apollo client structure)

On Apollo v2, Most of the parts are changed and also They removed redux integration inside of it.

@aarondancer
Copy link
Contributor

Something to note, they’ve remove Redux as the default cache for Apollo. Redux (as well as other stores) can still be used with configuration.

@dihmeetree
Copy link

Any update on this?

@Sly777
Copy link
Owner Author

Sly777 commented Jan 23, 2018

I'm planning to work on this on couple of weeks but PR's welcome :) @lolcoolkat

@willopez
Copy link

@Sly777 looking forward to this PR, and thank you for your work.

@ranleung
Copy link

hi, any update on this? :)

@Enalmada
Copy link
Contributor

I am extremely grateful for @sly77's contribution to the community. As a new user, this template looks like an amazing place to start containing much that I need to learn about. Please don't lose momentum on this amazing project.

@Sly777
Copy link
Owner Author

Sly777 commented Aug 29, 2018

Hey @willopez & @Enalmada! Honestly, I couldn't continue on this issue because of my new job and other changes. It would be really nice if someone helps me on this :)

@Enalmada
Copy link
Contributor

I totally know how that goes! I hope that someone watching that has some apollo experience would be willing to give back to the community and do this upgrade. I looked at the upgrade docs and they don't look too bad: https://www.apollographql.com/docs/apollo-server/v2/migration-two-dot.html
(I am currently just evaluating potential tech for upgrading our site and have not actually used any of the RAN tech yet but this template gives me confidence RAN is the way to go and will contribute in the future as I get up to speed)

@Sly777
Copy link
Owner Author

Sly777 commented Sep 11, 2018

I was working on this last weekend but I realized the biggest issue is the new local cache feature of Apollo. It doesn't fit redux well and I need to change the structure without redux which nobody wants I think :) I also tried to find redux plugins for this but there is no good option to integrate into RAN. So I stuck a little bit because of redux. I also thought maybe we can use something like this;

<Provider store={store}>
  <ApolloProvider client={client}>
     <Component {...props} />
  </ApolloProvider>
</Provider>

But in this structure, there are some missing parts between Apollo and Redux.

So it's open for any suggestions.

@Enalmada
Copy link
Contributor

Enalmada commented Sep 11, 2018

Experienced users will struggle emotionally with eliminating redux from their stack but based on my research it might be the right thing to do:

The new apollo is trying to intentionally and conveniently eliminate the cognitive and maintenance overhead of maintaining a separate local store (link). Relay is also going that direction. I believe users discovering RAN are mostly newer and wanting to learn production best practices and optimizations. There is no doubt they need to learn a graphql client. The question experienced users need to try and answer as unemotionally as possible...can the current version of apollo client (and perhaps some context) eliminate the price to learn and maintain redux or do new users still need it?

ReasonReact, what Facebook is migrating their internal production into, comes with the concept of reducer built into the language. The combination of this plus graphql client local store continually improving I believe is going to completely deprecate redux. Knowing redux is likely not part of our future might help people accept moving away from it now.

This thread here is valuable reading for anyone willing to help evaluate the pros/cons of potential best ways forward based on where we are at (linking directly to some real examples that might help but read the whole thread).

@Sly777 Perhaps this apollo-cache-redux could help bridge the gap which I saw in this thread? (actually doesn't feel like it supports redux 4 or is going to be maintained)

@Sly777
Copy link
Owner Author

Sly777 commented Jan 3, 2019

Thanks to @gufranmirza, RAN started to use new react apollo from now on!!

@Sly777 Sly777 closed this as completed Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants