mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

AppShell causes hydration errors when using Suspense #6883

Closed RabeeAbuBaker closed 1 month ago

RabeeAbuBaker commented 1 month ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.13.0

What package has an issue?

@mantine/core

What framework do you use?

Remix

In which browsers you can reproduce the issue?

All

Describe the bug

Using AppShell with Suspense inside causes the following error:

Uncaught Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.

I saw there was a related issue (#5979) that was fixed earlier, but it's still happening in the latest version (7.13.0).

image

If possible, include a link to a codesandbox with a minimal reproduction

https://github.com/RabeeAbuBaker/remix-defer/tree/simple-defer-app-shell

Possible fix

No response

Self-service

RabeeAbuBaker commented 1 month ago

Is there anything we can do locally to overcome this? @rtivital This is preventing us from using defer which has a huge impact on user experience. Thanks!

rtivital commented 1 month ago

I do not know, I've never used Suspense

RabeeAbuBaker commented 1 month ago

I do not know, I've never used Suspense

Since this was looked into and fixed before, is it possible to look into fixing this again? Or providing the functionality to disable what's breaking it.

rtivital commented 1 month ago

Okay, I'll leave this issue with "help wanted" label, you and anyone else are welcome to research it and submit a PR with a fix

RabeeAbuBaker commented 1 month ago

@rtivital I've opened a PR that fixes the issue. I've investigated the issue locally and the change resolved the error. I have added a screen recording for before and after the fix. Please review.

rtivital commented 1 month ago

Great, I will review and merge change with the next patch release