fix: revert flattenInnerRoot, use host-level authored-id + count-based rebind

Three changes to fix regression failures without breaking baselines:

1. Revert flattenInnerRoot in producer — use the original innerHTML
   inlining that preserves the existing DOM structure. Instead, set
   data-hf-authored-id on the HOST element so the scoped proxy can
   still rewrite #id selectors for sub-composition scripts.

2. Revert compiled.html baselines to main (no DOM structure changes).

3. Use timeline-count comparison instead of poll duration to decide
   whether to call __hfForceTimelineRebind. Compare timeline count
   before vs after the poll — rebind only when new timelines appeared
   during polling. This correctly identifies async compositions
   regardless of fetch speed, while leaving sync compositions
   untouched.
This commit is contained in:
Miguel Ángel
2026-05-18 10:20:17 -04:00
parent 0ff6296d64
commit 4bf2fa5cd1
4 changed files with 119 additions and 1806 deletions
+7 -3
View File
@@ -365,10 +365,14 @@ async function pollSubCompositionTimelines(
}
return true;
})()`;
const beforePoll = Date.now();
const timelinesBeforePoll = Number(
await page.evaluate(`Object.keys(window.__timelines || {}).length`),
);
const ready = await pollPageExpression(page, expression, timeoutMs, intervalMs);
const pollDurationMs = Date.now() - beforePoll;
if (ready && pollDurationMs > intervalMs * 2) {
const timelinesAfterPoll = Number(
await page.evaluate(`Object.keys(window.__timelines || {}).length`),
);
if (ready && timelinesAfterPoll > timelinesBeforePoll) {
await page.evaluate(`(function() {
if (typeof window.__hfForceTimelineRebind === "function") {
window.__hfForceTimelineRebind();