forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hydration errors caused by root ErrorOverlay (vercel#53216)
A bug was introduced in vercel#52843 that causes hydration issues -- this fixes that by moving the previous logic into the existing `isError` path that doesn't trigger a call to `hydrateRoot` ensuring we are only doing this on the client tree Fixes vercel#53110 and Fixes vercel#53006 Closes NEXT-1470
- Loading branch information
Showing
4 changed files
with
74 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...ages/next/src/client/components/react-dev-overlay/internal/helpers/get-socket-protocol.ts
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/next/src/client/components/react-dev-overlay/internal/helpers/get-socket-url.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function getSocketProtocol(assetPrefix: string): string { | ||
let protocol = window.location.protocol | ||
|
||
try { | ||
// assetPrefix is a url | ||
protocol = new URL(assetPrefix).protocol | ||
} catch (_) {} | ||
|
||
return protocol === 'http:' ? 'ws' : 'wss' | ||
} | ||
|
||
export function getSocketUrl(assetPrefix: string): string { | ||
const { hostname, port } = window.location | ||
const protocol = getSocketProtocol(assetPrefix) | ||
const normalizedAssetPrefix = assetPrefix.replace(/^\/+/, '') | ||
|
||
let url = `${protocol}://${hostname}:${port}${ | ||
normalizedAssetPrefix ? `/${normalizedAssetPrefix}` : '' | ||
}` | ||
|
||
if (normalizedAssetPrefix.startsWith('http')) { | ||
url = `${protocol}://${normalizedAssetPrefix.split('://')[1]}` | ||
} | ||
|
||
return url | ||
} |
23 changes: 5 additions & 18 deletions
23
packages/next/src/client/components/react-dev-overlay/internal/helpers/use-websocket.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters