mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
DevTools: Error for Tooltip in altered DOM
When the DOM is mutating and the user is hovering over the DOM tree, because the tooltip to display is fetched and displayed asynchronously, there is a race condition in which the tree element may be removed from the DOM and the time the pop-over is ready to display. In this case, the <li> in the DOM may fail to be found, and therefore an exception may be raised. Although the typings for this are indicated in the DOM Node prototype addition (enclosingNodeOrSelfWithNodeName), in that the function might return a null-value, that case wasn't previously handled in this code path. Change-Id: I0fcb3f13431b29894e3830ae801ec6a4a9305a26 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1872444 Reviewed-by: Lorne Mitchell <lomitch@microsoft.com> Reviewed-by: John Emau <John.Emau@microsoft.com> Commit-Queue: John Emau <John.Emau@microsoft.com>
This commit is contained in:
@@ -582,6 +582,9 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline {
|
||||
box: link.boxInWindow(),
|
||||
show: async popover => {
|
||||
const listItem = link.enclosingNodeOrSelfWithNodeName('li');
|
||||
if (!listItem) {
|
||||
return false;
|
||||
}
|
||||
const node = /** @type {!Elements.ElementsTreeElement} */ (listItem.treeElement).node();
|
||||
const precomputedFeatures = await Components.ImagePreview.loadDimensionsForNode(node);
|
||||
const preview = await Components.ImagePreview.build(
|
||||
|
||||
Reference in New Issue
Block a user