[FIX] devtools: fix apps patching and reload

This commit fixes issues introduced in the previous fix for the apps
methods patching and also fixes the status of the profiler tracing
on reload.
This commit is contained in:
Julien Carion (juca)
2023-04-27 12:57:57 +02:00
committed by Géry Debongnie
parent 9cc0f88e02
commit fe31f93c94
2 changed files with 18 additions and 3 deletions
@@ -509,7 +509,10 @@ export const store = reactive({
this.eventsTree = [];
this.activeRecorder = false;
evalFunctionInWindow("toggleEventsRecording", [false, 0]);
this.traceRenderings = false;
evalFunctionInWindow("toggleTracing", [false]);
this.traceSubscriptions = false;
evalFunctionInWindow("toggleSubscriptionTracing", [false]);
},
// Triggers manually the rendering of the selected component
@@ -46,6 +46,9 @@
this.appsPatched = false;
this.destroyPatched = false;
this.patchAppsSetMethods();
if (this.apps.size > 0) {
this.patchAppMethods();
}
this.recordEvents = false;
this.traceRenderings = false;
this.traceSubscriptions = false;
@@ -241,13 +244,22 @@
return;
}
let app = this.apps.values().next().value;
if (!app) {
return;
const self = this;
if (app.root) {
this.patchDestroyMethod(app.root);
} else {
const originalMount = app.constructor.prototype.mount;
app.constructor.prototype.mount = async function (...args) {
const result = await originalMount.call(this, ...args);
const root = this.root;
self.patchDestroyMethod(root);
app.constructor.prototype.mount = originalMount;
return result;
};
}
const originalFlush = app.scheduler.constructor.prototype.flush;
let inFlush = false;
let _render = false;
const self = this;
app.scheduler.constructor.prototype.flush = function () {
// Used to know when a render is triggered inside the flush method or not
inFlush = true;