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

feat(refetch): add optional parameter to include queries on standby when refetching #2804

Merged

Conversation

sondremare
Copy link
Contributor

@sondremare sondremare commented Jan 2, 2018

@apollo-cla
Copy link

apollo-cla commented Jan 2, 2018

Messages
📖

Please add your name and email to the AUTHORS file (optional)

Generated by 🚫 dangerJS

@sondremare
Copy link
Contributor Author

@jbaxleyiii Sorry to nag, but do you think this is something that I will be able to get merged? Or should I try and find another solution?

@kennethlynne
Copy link

https://media.giphy.com/media/9GLiEBLM0qiSQ/giphy.gif

@jbaxleyiii
Copy link
Contributor

@sondremare sorry for the delay! I'm open to merging, can you walk me through the use case for this?

@sondremare
Copy link
Contributor Author

sondremare commented Jan 5, 2018

General use of refetching in our app:
Ok. So we use a 3rd party pub/sub service provider to keep up to date on real time events in our app. Lets say we load some resources by graphql when you open the app, but then another user changes something, and we want that change to be reflected in our app. We then use updateQuery and updateFragment to make that happen. However, if the app has been in background or inactive for quite some while, we are unable to recover to proper state via the pub/sub provider. We then do a refetch of observed queries instead.

Here comes the problematic scenario:
However, if you have visited a certain screen (screen A) in our app and loaded the content relevant for that screen (which is now in cache). But then navigated back to another screen (screen B), then Screen A is then dismounted. Being that it is dismounted, the query for screen A is given a fetch-policy of "standby".
User then goes inactive while on screen B.

Time passes, user comes online again.
We do a refetch of observable queries. Screen A is skipped because it now has a fetch-policy of "standby". So the next time the user navigates to screen A, it will use the non-refetched cache. And that cache might be outdated. For some screens in our app, it very often is.

Hope this description was ok to follow @jbaxleyiii

@sondremare
Copy link
Contributor Author

@jbaxleyiii sorry to nag again.

@jbaxleyiii
Copy link
Contributor

@sondremare no reason to apologize! We had an offsite / planning week for work last week so I was 90% MIA! Picking back up now!

@jbaxleyiii
Copy link
Contributor

@sondremare perfect explanation! Lets do this!

@sondremare
Copy link
Contributor Author

Great :D thanks

@jbaxleyiii
Copy link
Contributor

Looks like travis is having trouble today! https://www.traviscistatus.com/ As soon as its cleared I'll merge in and it will be part of the release this week!

@sondremare
Copy link
Contributor Author

@jbaxleyiii can you merge it now?

@kennethlynne
Copy link

This is seriously taking ages, is not the PR ready for merging?

@jbaxleyiii jbaxleyiii merged commit 546d236 into apollographql:master Jan 29, 2018
@sondremare sondremare deleted the feat/refetch-include-standby branch January 29, 2018 16:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants