Commit Graph
19 Commits
Author SHA1 Message Date
SinachPat 4b7f14564a updated stuff 2026-05-10 00:45:55 +01:00
SinachPat c53db55209 updated stuff 2026-05-09 20:37:27 +01:00
SinachPat 3c5bbaea0b updated stuff 2026-05-09 20:23:34 +01:00
SinachPatandClaude Sonnet 4.6 1a5d84cb58 fix: make hook.inject robust against React Refresh timing race
Root cause: the React DevTools browser extension injects a hook stub at
document_start (before HTML parsing), so hook.inject can be undefined
when React Fast Refresh runs. React Refresh destructures inject as
undefined and later calls undefined.apply() -> TypeError. This prevents
React from ever setting injectedHook, so onCommitFiberRoot is never called.

Fix: unconditionally replace hook.inject with a wrapper that tries the
captured previous inject (with try/catch) then falls back to our own
renderer ID allocation. Works regardless of script execution order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 17:11:01 +01:00
SinachPatandClaude Sonnet 4.6 b59a3dddd3 debug: add console diagnostics to fiber hook to trace React detection failure
Logs at: script activation, React inject() call, onCommitFiberRoot fire,
and captureExistingTree DOM scan result. Temporary — remove after diagnosis.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 10:29:06 +01:00
SinachPatandClaude Sonnet 4.6 8af7dacacc fix: add inject() to legacy buildFiberHookScript hook as well
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 14:10:23 +01:00
SinachPatandClaude Sonnet 4.6 d1d5e352c8 fix: add inject() to DevTools hook so React actually calls onCommitFiberRoot
React's injectInternals() calls hook.inject(renderer) before it will ever
invoke onCommitFiberRoot. When inject is missing, React's try/catch silently
bails and injectedHook stays null — our handler is never reached regardless
of how correctly onCommitFiberRoot is set up.

Fix: define inject() on the hook we create (returns a renderer ID and stores
the renderer in hook.renderers, matching the React DevTools spec). Also
patches inject onto any existing stub hook that lacks it, so third-party
minimal hooks don't silently block registration.

This is the root cause of the 'Static HTML page' false positive on apps
that don't have the React DevTools browser extension installed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 14:04:29 +01:00
SinachPatandClaude Sonnet 4.6 f707ecd7b3 fix: broaden captureExistingTree to find React root in Next.js App Router
Next.js 13+ App Router calls hydrateRoot on <html> or <body> directly
(not on a #__next div), so __reactFiber$ annotations land on
document.documentElement or document.body.

Changes:
- Add document.documentElement to the candidate list (covers App Router)
- Extract getFiber() helper to remove repeated key-scan loop
- Add DOM-wide fallback scan (querySelectorAll('*')) so any React app
  is found regardless of its root container convention
- Remove the early !tree bail-out — post FIBER_TREE_UPDATE even with a
  sparse tree, matching onCommitFiberRoot's behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 10:52:27 +01:00
SinachPatandClaude Sonnet 4.6 8bbee987ff fix: resolve false 'static page' detection and missing route discovery on CLI-proxied apps
Three related fixes for the canvas live-render panel:

1. captureExistingTree() in fiber-hook — retroactively walks the already-
   mounted React fiber tree via __reactFiber$ DOM annotations. Called
   immediately on READY (handles post-hydration race) and again at 2 s
   (handles deferred hydration / Suspense). Prevents the 'Static HTML page'
   false positive on React apps that mounted before the hook script ran.

2. Static-page timer bumped from 4 s → 8 s in LiveArtboard to give the
   2-second captureExistingTree safety-net enough headroom before the
   no-React verdict fires.

3. Route discovery same-origin fix applied to both renderer/fiber-hook.ts
   and live-sdk/hook.ts — root-relative hrefs (starting with '/') are now
   accepted regardless of origin so CLI-proxied pages (where links still
   point to the original domain) expose their navigation routes correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 08:36:20 +01:00
SinachPat f21969f018 made tiny updates 2026-05-06 18:51:17 +01:00
SinachPat fdf64ee72c made tiny updates 2026-05-05 22:06:31 +01:00
SinachPat 3f029e15c2 made tiny updates 2026-05-03 20:34:18 +01:00
SinachPat 548cd11719 made tiny updates 2026-05-01 09:54:14 +01:00
SinachPat 84ddd2e248 made some updates 2026-05-01 07:30:29 +01:00
SinachPat b9bc234d1d made tiny updates 2026-05-01 06:28:49 +01:00
SinachPat 42ba668399 improved a lot of things 2026-04-30 16:47:26 +01:00
SinachPat 0c3ac48a3b improved a lot of things 2026-04-30 01:21:48 +01:00
SinachPat 45be1b935d improved a lot of things 2026-04-29 12:09:18 +01:00
SinachPat 97315846be improved a lot of things 2026-04-26 09:09:55 +01:00