Skip to content

Commit c0d3a43

Browse files
devvaannshabose
authored andcommitted
fix: stale raf references
1 parent 09d33b7 commit c0d3a43

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function RemoteFunctions(config = {}) {
5656
"dismiss", // when handler gets this event, it should dismiss all ui it renders in the live preview
5757
"createToolBox",
5858
"createInfoBox",
59-
"createHoverBox",
59+
"showHoverBox",
6060
"createMoreOptionsDropdown",
6161
// render an icon or html when the selected element toolbox appears in edit mode.
6262
"renderToolBoxItem",
@@ -470,7 +470,7 @@ function RemoteFunctions(config = {}) {
470470
if (element && element !== previouslySelectedElement) {
471471
_hoverHighlight.add(element);
472472
if (hoverBoxHandler) {
473-
hoverBoxHandler.createHoverBox(element);
473+
hoverBoxHandler.showHoverBox(element);
474474
}
475475
}
476476
}
@@ -494,10 +494,10 @@ function RemoteFunctions(config = {}) {
494494

495495
const element = event.target;
496496
if(!LivePreviewView.isElementInspectable(element) || element.nodeType !== Node.ELEMENT_NODE) {
497-
return false;
497+
return;
498498
}
499499
if(element && (element.closest('.phcode-no-lp-edit') || element.classList.contains('phcode-no-lp-edit-this'))) {
500-
return false;
500+
return;
501501
}
502502

503503
// Same element as last hover — nothing changed, skip entirely
@@ -1293,6 +1293,14 @@ function RemoteFunctions(config = {}) {
12931293
window.__current_ph_lp_selected = null;
12941294
}
12951295

1296+
// Reset hover tracking so the same-element skip doesn't suppress
1297+
// re-highlighting after a full state cleanup (e.g. Escape, dismiss).
1298+
_lastHoverTarget = null;
1299+
if (_pendingHoverRAF) {
1300+
cancelAnimationFrame(_pendingHoverRAF);
1301+
_pendingHoverRAF = null;
1302+
}
1303+
12961304
// Highlight.clear() removes all overlay divs (outline + margin/padding rects)
12971305
hideHighlight();
12981306

0 commit comments

Comments
 (0)