Skip to content

Commit

Permalink
use error overlay in app layouts (vercel#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Oct 25, 2022
1 parent d32aeef commit 722a967
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
8 changes: 3 additions & 5 deletions crates/next-core/js/src/dev/hot-reloader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import type React from "react";
import { useRouter, usePathname } from "next/dist/client/components/navigation";
import { useEffect } from "react";
import { onUpdate } from "./hmr-client";
import { ReactDevOverlay } from "./client";

export default function HotReload({
assetPrefix,
children,
}: React.PropsWithChildren<{ assetPrefix: string }>) {
export default function HotReload({ assetPrefix, children }): any {
const router = useRouter();
const path = usePathname().slice(1);
useEffect(() => {
Expand All @@ -27,5 +25,5 @@ export default function HotReload({
);
return unsubscribe;
}, [router, path]);
return children;
return <ReactDevOverlay globalOverlay={true}>{children}</ReactDevOverlay>;
}
7 changes: 0 additions & 7 deletions crates/next-core/js/src/dev/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,10 @@ export function connectHMR(options: HMROptions) {
// let timer: NodeJS.Timeout

function handleDisconnect() {
// clearInterval(timer)
source.close();
setTimeout(init, timeout);
}

// timer = setInterval(function() {
// if (Date.now() - lastActivity > timeout) {
// handleDisconnect()
// }
// }, timeout / 2)

const { hostname, port } = location;
const protocol = getSocketProtocol(options.assetPrefix || "");
const assetPrefix = options.assetPrefix.replace(/^\/+/, "");
Expand Down

0 comments on commit 722a967

Please sign in to comment.