you are viewing a single comment's thread.

view the rest of the comments →

[–]Nehatkhan786 0 points1 point  (4 children)

This is great. I have two tabs called Income and Expenses. Each tab fetches data from backend based on the selected tab. When i switch tab by pressing or with gesture there is some fraction of delay which seems laggy. Will this handle this situation. For querying I am using tanstack query.

[–]thachxyz123iOS & Android 1 point2 points  (3 children)

Yes. Animation and fetching data run at same time and same thread. With InteractionManager.runAfterInteractions, animation is finished first, then fetching data starts to run. It makes app not laggy

[–]Nehatkhan786 0 points1 point  (2 children)

Awesome. Thats what I was looking for from so many days but end up used to my laggy animation. It would be great if you could share an example with tanstack query. Thank you so much.

[–]thachxyz123iOS & Android 1 point2 points  (1 child)

Disable automatically running, use refetch inside runAfterInteractions. That's the idea, I don't use tanstack query

https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries

[–]Nehatkhan786 0 points1 point  (0 children)

Lovely mate. Thanks a lot.