Open
Description
- Check if updating to the latest Preact version resolves the issue
Describe the bug
Preact's Suspense boundary does not maintain state synchronization or properly handle Promise resolution compared to React. When a component throws a Promise within a Suspense boundary:
React smoothly transitions from fallback to resolved content and continues propagating state updates (e.g., active state changes are logged).
Preact stops propagating state updates (e.g., active logs disappear after the first throw), and fails to transition back to resolved content.
This discrepancy prevents Preact from supporting dynamic UI transitions (e.g., loading states) that rely on Suspense with thrown Promises.
To Reproduce
- Open React example: https://stackblitz.com/edit/vitejs-vite-zbtfqxzc?file=src%2FApp.tsx
- Toggle the button to observe:
- Proper fallback/nofallback transitions
- Console logs showing active state changes during throws
- Toggle the button to observe:
- Open Preact example: https://stackblitz.com/edit/create-preact-starter-oemy1da4?file=src%2Findex.jsx
- Toggle the button to observe:
- Console logs stop showing active state changes after the first throw
Expected Behavior:
Like React, Preact should:
- Maintain state propagation (show active state changes in console)
- Transition smoothly from fallback to normal content when resolving the thrown promise
Actual Behavior:
Preact:
- Stops propagating state changes (active state logs disappear after first throw)
- Fails to transition back to normal content