Skip to content

Commit 5791a38

Browse files
authored
fix(replay): Update matcher for hydration error detection to new React docs (#12209)
1 parent ca4afef commit 5791a38

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/replay-internal/src/coreHandlers/handleBeforeSendEvent.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ function handleHydrationError(replay: ReplayContainer, event: ErrorEvent): void
2929
if (
3030
// Only matches errors in production builds of react-dom
3131
// Example https://reactjs.org/docs/error-decoder.html?invariant=423
32-
exceptionValue.match(/reactjs\.org\/docs\/error-decoder\.html\?invariant=(418|419|422|423|425)/) ||
32+
// With newer React versions, the messages changed to a different website https://react.dev/errors/418
33+
exceptionValue.match(
34+
/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/,
35+
) ||
3336
// Development builds of react-dom
3437
// Error 1: Hydration failed because the initial UI does not match what was rendered on the server.
3538
// Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match.

0 commit comments

Comments
 (0)