DEV Community

Discussion on: Practical data fetching with React Suspense that you can use today

Collapse
 
zackdotcomputer profile image
Zack Sheppard

Ok, I think I figured it out.

The issue is that you need some way to persist the state that is in flight to some point outside of the Suspense boundary. Because the Suspense-aware API requires throwing a value, it interrupts the execution of the component(s) underneath the nearest Suspense component, meaning that any values in their state (including their hooks' states) are wiped out.

reactfire gets away with its design pattern because it has the context provider higher up in the component tree where it can hang the loads in progress.