-
Notifications
You must be signed in to change notification settings - Fork 786
Refetching query from component returns "loading: true" #61
Comments
Not sure about the bug, but:
Yep, the two options are that, or I think this bug would be easier to identify with a reproduction. |
In this example, props.something.loading will be true initially (because query hasn't finished). Then if I refetch from <\RealComponent />, props.something.loading will be true because refetch was requested. After that props.something.loading never becomes false.
|
Also, I'd like to point out that I don't think pollInterval is a very good solution for re-fetching/reactivity. |
Is there a better one that is equally simple? What would you prefer? |
Well, in my app, I have web sockets running and I'm using that to re-fetch when necessary. |
Ah that's a great pattern! Any way I can help make that approach easier? Perhaps we should add something to the docs about it. |
I'm running into the same issue using React Native:
Pressing the refresh button will correctly refetch the account query, but 'this.props.account.loading' will still be true. |
@timbotnik @saeho @brettlaforge I did find that if the data didn't change on refetch, it wouldn't rerender and update the loading state. That is fixed in #67 (0.3.7). Would you see if that fixes your issue? |
Closing for now, if this issue still persists let me know! |
Working for me, thx @jbaxleyiii! |
Works for me as well. Thank you. On Wed, Jun 1, 2016 at 9:37 PM, timbotnik [email protected] wrote:
|
I'm experiencing this on 0.3.19. Same circumstances. Data is always loaded successfully on refetch. But if it hasn't changed, |
@fusepilot so refetch where data is the same still is |
@jbaxleyiii I'm not so sure now, it may be a new issue. There's one `connect``ed component that I have working that's very similar to the one that's not working. I haven't yet been able to find what's different other than it having a different query. |
@fusepilot it looks like something changed in the apollo-client. What version are you using? |
@jbaxleyiii 0.4.8. Just tried 0.4.9, same results. |
@fusepilot yeah I don't think the client reruns the |
@fusepilot I've got a fix. I'll work on a release tonight! |
@jbaxleyiii awesome, thank you! |
fixed again |
@jbaxleyiii it works! thanks again! |
I think the problem still persists in 0.4.7 in case when only variables change but results stay the same. |
@jbaxleyiii can you confirm that my fix is ok? Should I open PR? |
@msimulcik it looks like it should work! A lot of the loading logic has moved to core so we can remove some of my custom stuff like you did. A PR would be great! |
@msimulcik what version of apollo-client are you using? |
@msimulcik I tried to add a failing test for the issue you described but can't seem to get it to fail? #173 |
@jbaxleyiii, I'm using apollo-client 0.4.13. Let me take a look at that test and I'll let you know if I can get it to fail. |
try to replicate apollographql#170 and new issue on apollographql#61
I added the test case and opened the PR #176 |
fixed again in next release! |
I think I'm experiencing a related issue in react-native with apollo-client v.0.5.25: Data has been loaded -> Turn off Internet connection -> Refetch -> Error -> Turn on Internet connection -> Refetch -> Component not rerendered Although debugger displays loading to become false after second refetch, It works as expected if I set |
@binchik if you're still experiencing it, please open a new issue so we can see it's still open! |
After fetching a query using mapQueriesToProps(), If I refetch the query from the React Component, the returned query has "loading: true" and it never resets to "loading: false" even though the loading is clearly finished.
While on the subject, is the best way to trigger a data refresh by doing a .refetch() inside the react component when its appropriate to do so?
The text was updated successfully, but these errors were encountered: