From c53db5520979f0c555351b48b11c07e8c3bbb797 Mon Sep 17 00:00:00 2001 From: SinachPat Date: Sat, 9 May 2026 20:37:27 +0100 Subject: [PATCH] updated stuff --- packages/renderer/src/fiber-hook.ts | 106 ++++++++++++++++++---------- 1 file changed, 70 insertions(+), 36 deletions(-) diff --git a/packages/renderer/src/fiber-hook.ts b/packages/renderer/src/fiber-hook.ts index 5b0e77f..af35838 100644 --- a/packages/renderer/src/fiber-hook.ts +++ b/packages/renderer/src/fiber-hook.ts @@ -179,58 +179,92 @@ export function buildProxyFiberHookScript(): string { } // ── React DevTools global hook ──────────────────────────────────────────── - // Strategy: completely replace window.__REACT_DEVTOOLS_GLOBAL_HOOK__ with a - // fresh, fully-specified hook object. This eliminates all timing hazards: + // Two-layer bulletproof strategy: // - // 1. Chrome DevTools extension injects at document_start (before HTML is - // parsed) and installs a stub where hook.inject = undefined. Patching - // that stub still leaves React Refresh free to capture undefined before - // our patch runs. Replacing the object entirely avoids the problem. + // LAYER 1 — Lock the global: replace window.__REACT_DEVTOOLS_GLOBAL_HOOK__ + // with our fresh hook, then make the property non-writable so neither the + // Chrome DevTools extension (which runs at document_start and may + // re-initialize) nor any webpack module can swap it out again. // - // 2. React Refresh (Next.js dev) runs after our