fix(webui): guard new intrinsic-height helpers with typeof so node harnesses that extract renderMessages/_measureMessageVirtualRow keep passing
The node test harnesses (e.g. test_anchor_fallback_ownership) extract
renderMessages and _measureMessageVirtualRow by source and run them with every
collaborator stubbed by name. The new _applyUserRowIntrinsicHeight /
_rememberUserRowIntrinsicHeight helpers were not among those stubs, so the
extracted functions threw ReferenceError ("node behavior check failed") on the
CI shard that runs those files. Gate both cross-function call sites on
`typeof helper === 'function'` (same pattern already used across ui.js for
harness-extracted helpers). Production always has the helpers defined, so the
guard is a no-op there; a harness without them cleanly skips the reservation
and keeps prior behavior. No behavior change on the real page.
This commit is contained in:
1 parent
034d682452
commit
12a45c655f
1 file changed
+9
-4
+9
-4
@@ -1214,8 +1214,11 @@ function _measureMessageVirtualRow(inner, entry){
|
||||
}
|
||||
// Persist the measured height so a later wipe-and-rebuild of this user row reserves its
|
||||
// real off-screen height instead of collapsing to the 96px estimate (the collapse that
|
||||
// clamps/re-anchors the viewport — #5637/#5638 mobile jump-back, both classes).
|
||||
if(totalHeight>0 && primary.dataset && primary.dataset.role==='user'){
|
||||
// clamps/re-anchors the viewport — #5637/#5638 mobile jump-back, both classes). The
|
||||
// typeof guard keeps _measureMessageVirtualRow runnable in the node test harnesses that
|
||||
// extract it without this helper (they stub every collaborator by name).
|
||||
if(totalHeight>0 && primary.dataset && primary.dataset.role==='user'
|
||||
&& typeof _rememberUserRowIntrinsicHeight==='function'){
|
||||
_rememberUserRowIntrinsicHeight(primary.dataset.sessionMsgIdx, totalHeight);
|
||||
primary.style.containIntrinsicSize='auto '+Math.round(totalHeight)+'px';
|
||||
}
|
||||
@@ -14001,8 +14004,10 @@ function renderMessages(options){
|
||||
// does not collapse scrollHeight to the flat 96px estimate (the collapse that
|
||||
// clamps/re-anchors the viewport on mobile — #5637/#5638, both jump classes). Uses
|
||||
// the remembered measured height when this row has been measured before, else a
|
||||
// content-length estimate; the measure pass refines it exactly next frame.
|
||||
_applyUserRowIntrinsicHeight(row, newRawText);
|
||||
// content-length estimate; the measure pass refines it exactly next frame. The
|
||||
// typeof guard keeps renderMessages runnable in the node test harnesses that
|
||||
// extract it without this helper (they stub every collaborator by name).
|
||||
if(typeof _applyUserRowIntrinsicHeight==='function') _applyUserRowIntrinsicHeight(row, newRawText);
|
||||
inner.appendChild(row);
|
||||
userRows.set(rawIdx, row);
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user