OpenCut icon indicating copy to clipboard operation
OpenCut copied to clipboard

[BUG] Hydration mismatch warning in dev caused by browser extensions (e.g. Grammarly)

Open MartinYTSo opened this issue 5 months ago • 1 comments

Platform

Windows 11

Browser

Chrome

Current Behavior

I received this error after doing bun run dev

[Client] A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:

- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

%s%s https://react.dev/link/hydration-mismatch

  ...
    <Await promise={Promise}>
      <AwaitInner promise={Promise}>
        <RouterProvider router={{...}}>
          <RouterContextProvider router={{...}}>
            <Matches>
              <SafeFragment fallback={null}>
                <Transitioner>
                <MatchesInner>
                  <CatchBoundary getResetKey={function getResetKey} errorComponent={function ErrorComponent} ...>
                    <CatchBoundaryImpl getResetKey={function getResetKey} onCatch={function}>
                      <MatchImpl matchId="__root__/">
                        <MatchView router={{...}} matchId="__root__/" resetKey={0} matchState={{routeId:"_...", ...}}>     
                          <RootDocument>
                            <html lang="en" data-tsd-source="/src/route...">
                              <head>
                              <body
                                data-tsd-source="/src/routes/__root.tsx:56:7"
-                               data-new-gr-c-s-check-loaded="14.1302.0"
-                               data-gr-ext-installed=""
                              >``

### Expected Behavior

No hydration mismatch warning (or documented as a known dev-only quirk).


### Recurrence Probability

Always

### Steps To Reproduce

1. Clone repo and run `bun install && bun run dev`
2. Open http://localhost:5173 with Grammarly (or similar) enabled
3. Open browser console

### Anything else?

_No response_

MartinYTSo avatar Jun 13 '26 06:06 MartinYTSo

Hi maintainers! 👋

I have prepared a clean fix for this issue in my fork (asiimhusain/OpenCut).

  • Branch: fix/issue-823-hydration-warning
  • Fix: Added suppressHydrationWarning to <html> and <body> in apps/web/src/routes/__root.tsx to handle browser extension attribute injection.

Since PR creation is currently restricted to collaborators, please let me know if you can grant collaborator access to open the PR, or feel free to review the branch here: https://github.com/asiimhusain/OpenCut/tree/fix/issue-823-hydration-warning

asiimhusain avatar Aug 11 '26 08:08 asiimhusain