mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb/component: better handling for t-debug
- fix issue with t-debug on a t-set (defining a slot) - put t-debug and t-log at a very low (high) priority to make sure they are executed before other directives closes #201
This commit is contained in:
+7
-4
@@ -322,10 +322,13 @@ export class QWeb extends EventBus {
|
||||
);
|
||||
}
|
||||
if (isDebug) {
|
||||
console.log(
|
||||
`Template: ${this.templates[name].elem.outerHTML}\nCompiled code:\n` +
|
||||
template.toString()
|
||||
);
|
||||
const tpl = this.templates[name];
|
||||
if (tpl) {
|
||||
const msg = `Template: ${
|
||||
tpl.elem.outerHTML
|
||||
}\nCompiled code:\n${template.toString()}`;
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ QWeb.addDirective({
|
||||
//------------------------------------------------------------------------------
|
||||
QWeb.addDirective({
|
||||
name: "debug",
|
||||
priority: 99,
|
||||
priority: 1,
|
||||
atNodeEncounter({ ctx }) {
|
||||
ctx.addLine("debugger;");
|
||||
}
|
||||
@@ -315,7 +315,7 @@ QWeb.addDirective({
|
||||
//------------------------------------------------------------------------------
|
||||
QWeb.addDirective({
|
||||
name: "log",
|
||||
priority: 99,
|
||||
priority: 1,
|
||||
atNodeEncounter({ ctx, value }) {
|
||||
const expr = ctx.formatExpression(value);
|
||||
ctx.addLine(`console.log(${expr})`);
|
||||
|
||||
Reference in New Issue
Block a user