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

0.5.22 breaks refetchQueries, reducer, updateQueries #1129

Closed
mmmdreg opened this issue Jan 5, 2017 · 13 comments
Closed

0.5.22 breaks refetchQueries, reducer, updateQueries #1129

mmmdreg opened this issue Jan 5, 2017 · 13 comments

Comments

@mmmdreg
Copy link

mmmdreg commented Jan 5, 2017

I have a pretty basic setup where I am on an 'overview' page, I click a 'create' button which navigates to another page where I can then fill out a form, submit it, and return to the overview page where the submitted item should be reflected.

The submission is a mutation and was using refetchQueries to reload the query loading the overview page. This has recently stopped working.

Checking various versions, it last worked in 0.5.21 and broke in 0.5.22, which seems to have involved changing related functionality.

Basically anywhere in my app using refetchQueries now does nothing and results in stale state.

Is anyone else seeing similar issues?

@helfer
Copy link
Contributor

helfer commented Jan 5, 2017

@mmmdreg Thanks for the bug report! I think this is due to the same change that was mentioned in #1085. The gist of it is that inactive queries now get removed from the store, so their reducer functions no longer run, and they also no longer get refetched unless they are active at that time. It turns out that what I thought was just fixing a bug turned out to also disable a behavior that a lot of people depended on.

We'll make this a priority to provide a better solution for updating the cache. Expect to see some activity in that direction early next week!

clarification: In addition refetchQueries this issue also affects updateQueries and the reducer option to watchQuery.

update (Jan 22, 2017): We've come up with a design that we think is workable and start implementing it this week.

@booboothefool
Copy link

booboothefool commented Jan 5, 2017

@helfer

The gist of it is that inactive queries now get removed from the store, so their reducer functions no longer run, and they also no longer get refetched unless they are active at that time. It turns out that what I thought was just fixing a bug turned out to also disable a behavior that a lot of people depended on.

Is this why updateQueries stopped working all over my app (doesn't update anything) when I upgraded from 0.5.6 to 0.5.25? If so, what the best action to take to keep things working? Will this be fixed in a later release, or is there a particular way I should be rewriting my updateQueries?

@helfer
Copy link
Contributor

helfer commented Jan 6, 2017

@booboothefool yes, most likely sorry. If I knew that more people ran into this issue, I would have deprecated 0.5.22 and released it again as 0.6. Unfortunately only one person filed an issue or said anything, so it seemed okay to just keep things as they were since it was considered a bug fix.

I will get on this asap.

@kyen99
Copy link

kyen99 commented Jan 10, 2017

We're running into the same issue and had to lock our version at 0.5.21 until it's resolved.

@DenisGorbachev
Copy link

@helfer ran into the same issue as well

@mlukaszczyk
Copy link

Hey all,

I know that the issue is being discussed in #1224, but does a workaround exist for this? The application that my team and I are developing, heavily relies on this feature.

Best regards,

Michael

@marktani
Copy link
Contributor

marktani commented Feb 1, 2017

The current workaround seems to be to downgrade to 0.5.21 :)

@mlukaszczyk
Copy link

@marktani yes, unfortunately we then run into this issue again #993

@calebmer
Copy link
Contributor

calebmer commented Feb 1, 2017

@mlukaszczyk you could not unsubscribe from queries you still may want to update. For React this means not unmounting components with queries you want to update.

@DimitryDushkin
Copy link
Contributor

@mlukaszczyk @marktani I've set forceFetch in query options and it works fine.)

MatthieuSegret pushed a commit to MatthieuSegret/graphql-rails-blog that referenced this issue Feb 10, 2017
MatthieuSegret pushed a commit to MatthieuSegret/graphql-rails-blog that referenced this issue Feb 12, 2017
@Siyfion
Copy link
Contributor

Siyfion commented Feb 15, 2017

@calebmer's new PR over here: apollographql/react-apollo#462 solved all of my outstanding issues. I would recommend that people pull the change locally and give it a test.

@marktani
Copy link
Contributor

Thanks for the heads up @Siyfion 👍

@helfer
Copy link
Contributor

helfer commented Mar 6, 2017

I'll close this for now.

@helfer helfer closed this as completed Mar 6, 2017
rordev4 added a commit to rordev4/graphql-rails-blog that referenced this issue Aug 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants