Skip to content

Commit f686472

Browse files
Alexander VakrilovMartoYankov
authored andcommitted
fix(dev-tools): use app root in getDocument() (#8071)
1 parent 7fa9978 commit f686472

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎nativescript-core/debugger/devtools-elements.common.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { getNodeById } from "./dom-node";
44
import { ViewBase } from "../ui/core/view-base";
55
import { mainThreadify } from "../utils/utils";
66

7+
// Use lazy requires for core modules
8+
const getAppRootView = () => require("../application").getRootView();
9+
710
let unsetValue;
811
function unsetViewValue(view, name) {
912
if (!unsetValue) {
@@ -24,19 +27,19 @@ function getViewById(nodeId: number): ViewBase {
2427
}
2528

2629
export function getDocument() {
27-
const topMostFrame = require("../ui/frame").Frame.topmost();
28-
if (!topMostFrame) {
30+
const appRoot = getAppRootView();
31+
if (!appRoot) {
2932
return undefined;
3033
}
3134

3235
try {
33-
topMostFrame.ensureDomNode();
36+
appRoot.ensureDomNode();
3437

3538
} catch (e) {
3639
console.log("ERROR in getDocument(): " + e);
3740
}
3841

39-
return topMostFrame.domNode.toObject();
42+
return appRoot.domNode.toObject();
4043
}
4144

4245
export function getComputedStylesForNode(nodeId): Array<{ name: string, value: string }> {

0 commit comments

Comments
 (0)