-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useBackgroundQuery + refetch Suspense UI bug? (pull to refresh ScrollView in RN + Expo) #11243
Comments
Hey @mvolonnino 👋 The way you setup the code looks correct to me. Thanks for reporting! |
@jerelmiller - sure thing! this would be my first time doing something like this, what do you mean a reproduction? Also - a quick thing to note, Will do more digging for that as well *update
*update 2 update 3
that works within Expo Go on both iOS sim and device (albeit the UI flickers on Android expo go (only tested on device, the simulator does not work very well at all on my laptop)). After building with the Now in both of my EAS builds ( Hope that is a little clearer on the circumstance of this issue 🤣 |
@jerelmiller @bignimbus - just reaching out to see what else is needed from me in terms of this issue. Would love to get these new Let me know if theres anything I can do! |
@mvolonnino apologies I've been slow to respond. I was at a conference last week and am gearing up for another one next week. Hoping I have some time to dig into this more sometime soon! |
@jerelmiller - just checking in and seeing if this has had any traction? Don't want to reiterate anything said already and I obviously know how busy the maintainers of this library are, but would love to get this into production 🚀 Let me know how its going - and if I can do anything else. |
@mvolonnino Apologies again! I promise this is on my todo list, but I just won't be able to promise anything for likely another few weeks. I'm speaking at my 3rd conference this week in the last 4 weeks and have 2 more in November, so I've been traveling quite a bit and have not had the time I had hoped to really dig into this stuff. React Native has been a tricky one as we've seen quite a few funky issues with it not working quite as intended in situations where it works perfectly fine on the web. You're using the New Architecture correct? I came across something recently that mentioned this was crucial to getting Suspense working properly (I can't seem to find the link, apologies). If you're keen on seeing some progress sooner, feel free to dig into the So with that, here is how I'd recommend digging into the issue: Try your example with If you're still seeing the same issues with The way This is one of the key pieces to how Apollo provides Suspense support in these hooks. It needs to be able to handle being in the "old" and "new" states at the same time. This is done by providing a That Essentially we need to figure out if that Hopefully this all makes sense! Again, don't feel like you need to dig in, but hopefully this gives you a starting point if you're interested and would like to move this along faster. I'm sorry I can't provide more help right now but conferences + priorities right now are making it difficult to get to. |
Edit: I found this discussion which has some mentions that using |
Hi, I am also having an issue with So it DOES seem an issue with React Native. UPDATE: it is -> facebook/react-native#42101 (comment) |
Been digging for hours and cant find anything on this issue.
I have a useBackgroundQuery + a full screen Suspense loading fallback. Everything works as expected on first load, the fallback skeleton shows when the App loads. I have a ScrollView wrapping children that utilize useReadyQuery with the queryRef passed for grabbing the data when the query has resolved.
Problem arises is when I pull to refresh (grab new data from the useBackgroundQuery to replenish the components that need to display anything new from the server).
On that pull to refresh, the suspense fallback UI shows, along with the screen components as well and it is some poor UI. I would expect this to work like a normal useQuery, where I can utilize the refetch in juncture with a refreshControl prop where I pull to refresh, the RefreshControl shows, while keep the loading from the useQuery as false to keep the UI of loading to the RefreshControl, and the components update when the refetching has complete.
I see this pr: #10809 which shows a fix for useSuspenseQuery but not sure if this pertains to the useBackgroundQuery
Also read this from the docs: https://www.apollographql.com/docs/react/data/suspense/#refetching-and-pagination
minimal code repro:
"@apollo/client": "^3.8.1",
"expo": "^49.0.0",
"react-native": "0.72.4",
I originally had it setup with a refreshing state within the HomeContent, and would update that on pull to refresh. This works as expected as well without any of the useTranistion (implemented from finding this issue) hooks in Expo Go, but when building expo-dev-client and an EAS build for internal testing, the issue happens.
You can see that the HomeContent is wrapped with Home, which holds the , when i pull to refretch on the ScrollView, the HomeContent stays rendered, but the Suspense fallback is also rendered creating a very jarring / poor UI experience which DOESNT happen in Expo Go, but does when building with EAS build ( both with dev client true, and a preview build)
Anyone come across this issue or am I miss reading the docs somehow?
Tasks
The text was updated successfully, but these errors were encountered: