You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a stackblitz where I am forcing a hydration error. As you can see, the deferred data never resolves.
If the hydration error is fixed, deferring starts working again.
defer should still work, even when hydration errors are happening. They can easily be missed, and sometimes there is nothing a developer can do to prevent them (e.g. the user is using Adblocks)
Actual Behavior
defer breaks on hydration errors
The text was updated successfully, but these errors were encountered:
The current workaround is to update to the latest React v19. It is currently in RC and should be final soon.
The issue with defer and hydration is that when there are hydration errors, React will re-render the page client-side. This removes the code that Remix uses to process the deferred promise. - @kiliman
Would it be possible to make this break more visible and clear, indicating what just happened? Currently, it just stops working without any error, warning, or indication.
Since the hydration error only occurs on full document requests, perhaps Remix should include something in the initial context to indicate a deferred promise is in process.
If the client re-renders before the promise is resolved, assume something went wrong and revalidate the page. This will trigger the loader again and should work this time as it's now a client navigation.
Reproduction
This is a stackblitz where I am forcing a hydration error. As you can see, the deferred data never resolves.
If the hydration error is fixed, deferring starts working again.
https://stackblitz.com/edit/mosattler-remix-repro-defer-search-params-njpsxx?file=app%2Froutes%2F_index.tsx
System Info
Used Package Manager
npm
Expected Behavior
defer should still work, even when hydration errors are happening. They can easily be missed, and sometimes there is nothing a developer can do to prevent them (e.g. the user is using Adblocks)
Actual Behavior
defer
breaks on hydration errorsThe text was updated successfully, but these errors were encountered: