fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Bug]: Hydration error when using `TabList` with Next.js's `app` router

Open leduyquang753 opened this issue 1 year ago • 5 comments

Library

React Components / v9 (@fluentui/react-components)

System Info

System:
  OS: Windows 11 10.0.22631
  CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
  Memory: 10.74 GB / 19.78 GB
Browsers:
  Edge: Chromium (120.0.2210.61)
  Internet Explorer: 11.0.22621.1

Are you reporting Accessibility issue?

no

Reproduction

https://codesandbox.io/p/devbox/fluent-tablist-bug-qm8hqd

Bug Description

Actual behavior

Hydration error:

Error: Hydration failed because the initial UI does not match what was rendered on the server.
Warning: Did not expect server HTML to contain a <i> in <div>.

Expected behavior

The page hydrates normally.

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

leduyquang753 avatar Dec 16 '23 08:12 leduyquang753

Additional notes:

  • There was #28713 reporting the same issue but it was closed due to lack of reproduction.
  • The CodeSandbox as was recommended seems to be very finnicky to successfully get up and running, if it doesn't work then I would recommend setting it up locally by using create-next-app then putting the files in app in.

leduyquang753 avatar Dec 16 '23 08:12 leduyquang753

Any progress on this issue? We are experiencing the same issue with the TabList component in our Next.js and Fluent UI project. After some investigations we have seen that the errors only occur in development mode (which is good I guess), but we would also like to get rid of the errors locally. Adding the flag suppressHydrationWarning doesn't help.

Heres a reproduction of the error in CodeSandbox: https://codesandbox.io/p/devbox/nextjs-fluent-tablist-bug-fdqd6m. CodeSandbox is a bit grumpy so if the errors aren't shown immediately, try to refresh the full page and until they appear.

eleni-kamvissis avatar Feb 07 '24 09:02 eleni-kamvissis

This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes. Still require assistance? Please add comment - "keep open".

keep open

igorstefaniak avatar Aug 07 '24 18:08 igorstefaniak

image

https://codesandbox.io/p/devbox/fluent-tablist-bug-forked-ldhjl7

Tabster related.

layershifter avatar Aug 13 '24 08:08 layershifter

related issue maybe in next.js 15 also. https://github.com/microsoft/fluentui/issues/33388#issuecomment-2516189244

anishkumar127 avatar Dec 04 '24 04:12 anishkumar127

it shown for SSR. in next js and also on Remix.

extra attributes, data tabster

antonius-ivan avatar Feb 26 '25 01:02 antonius-ivan

My React Router SSR for NavDrawer is style Leak. But When i use Drawer, the error is same. Extra Attributes, data-tabaster, style. Like you said, tabster related

antonius-ivan avatar Feb 26 '25 07:02 antonius-ivan

@fluentui/[email protected] 🔴

Image

@fluentui/[email protected]

Image

Seems that it was accidentally fixed by #34113. Looks that as we don't invoke Tabster during render anymore, we don't cause conflicts in hydration.

layershifter avatar Apr 03 '25 15:04 layershifter