From f013c5705090faf100c4184918af5367db475067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 14 Jun 2019 15:40:32 +0200 Subject: [PATCH] [REF] component: rename t-async into t-asyncroot --- doc/component.md | 4 ++-- doc/qweb.md | 20 ++++++++++---------- src/qweb_extensions.ts | 4 ++-- tests/__snapshots__/component.test.ts.snap | 6 +++--- tests/component.test.ts | 12 ++++++------ 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/doc/component.md b/doc/component.md index b909c29d..c072d974 100644 --- a/doc/component.md +++ b/doc/component.md @@ -928,7 +928,7 @@ Here are a few tips on how to work with asynchronous widgets: 3. Lazy loading external libraries is a good use case for async rendering. This is mostly fine, because we can assume that it will only takes a fraction of a second, and only once (see `owl.utils.loadJS`) -4. For all the other cases, the `t-async` directive (to use alongside +4. For all the other cases, the `t-asyncroot` directive (to use alongside `t-widget`) is there to help you. When this directive is met, a new rendering sub tree is created, such that the rendering of that component (and its children) is not tied to the rendering of the rest of the interface. It can @@ -941,6 +941,6 @@ Here are a few tips on how to work with asynchronous widgets: ```xml
- +
``` diff --git a/doc/qweb.md b/doc/qweb.md index e1635963..60cde467 100644 --- a/doc/qweb.md +++ b/doc/qweb.md @@ -65,16 +65,16 @@ We present here a list of all standard QWeb directives: The component system in Owl requires additional directives, to express various needs. Here is a list of all Owl specific directives: -| Name | Description | -| ------------------------------------ | ----------------------------------------------------------------------------------- | -| `t-widget`, `t-keepalive`, `t-async` | [Defining a sub component](component.md#composition) | -| `t-ref` | [Setting a reference to a dom node or a sub component](component.md#references) | -| `t-key` | [Defining a key (to help virtual dom reconciliation)](component.md#t-key-directive) | -| `t-on-*` | [Event handling](component.md#event-handling) | -| `t-transition` | [Defining an animation](animations.md#css-transitions) | -| `t-mounted` | [Callback when a node or component is mounted](component.md#t-mounted-directive) | -| `t-slot` | [Rendering a slot](component.md#slots) | -| `t-model` | [Form input bindings](component.md#form-input-bindings) | +| Name | Description | +| -------------------------------------------- | ----------------------------------------------------------------------------------- | +| `t-widget`, `t-keepalive`, `t-asyncroot` | [Defining a sub component](component.md#composition) | +| `t-ref` | [Setting a reference to a dom node or a sub component](component.md#references) | +| `t-key` | [Defining a key (to help virtual dom reconciliation)](component.md#t-key-directive) | +| `t-on-*` | [Event handling](component.md#event-handling) | +| `t-transition` | [Defining an animation](animations.md#css-transitions) | +| `t-mounted` | [Callback when a node or component is mounted](component.md#t-mounted-directive) | +| `t-slot` | [Rendering a slot](component.md#slots) | +| `t-model` | [Form input bindings](component.md#form-input-bindings) | ## QWeb Engine diff --git a/src/qweb_extensions.ts b/src/qweb_extensions.ts index 8bd27a8c..cdc7b737 100644 --- a/src/qweb_extensions.ts +++ b/src/qweb_extensions.ts @@ -361,7 +361,7 @@ const T_WIDGET_MODS_CODE = Object.assign({}, MODS_CODE, { QWeb.addDirective({ name: "widget", - extraNames: ["props", "keepalive", "async"], + extraNames: ["props", "keepalive", "asyncroot"], priority: 100, atNodeEncounter({ ctx, value, node, qweb }): boolean { ctx.addLine("//WIDGET"); @@ -369,7 +369,7 @@ QWeb.addDirective({ ctx.rootContext.shouldDefineQWeb = true; ctx.rootContext.shouldDefineUtils = true; let keepAlive = node.getAttribute("t-keepalive") ? true : false; - let async = node.getAttribute("t-async") ? true : false; + let async = node.getAttribute("t-asyncroot") ? true : false; // t-on- events and t-transition const events: [string, string[], string, string][] = []; diff --git a/tests/__snapshots__/component.test.ts.snap b/tests/__snapshots__/component.test.ts.snap index c28c943c..abada199 100644 --- a/tests/__snapshots__/component.test.ts.snap +++ b/tests/__snapshots__/component.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`async rendering delayed t-widget with t-async directive 1`] = ` +exports[`async rendering delayed t-widget with t-asyncroot directive 1`] = ` "function anonymous(context,extra ) { let utils = this.utils; @@ -81,7 +81,7 @@ exports[`async rendering delayed t-widget with t-async directive 1`] = ` }" `; -exports[`async rendering fast t-widget with t-async directive 1`] = ` +exports[`async rendering fast t-widget with t-asyncroot directive 1`] = ` "function anonymous(context,extra ) { let utils = this.utils; @@ -162,7 +162,7 @@ exports[`async rendering fast t-widget with t-async directive 1`] = ` }" `; -exports[`async rendering t-widget with t-async directive: mixed re-renderings 1`] = ` +exports[`async rendering t-widget with t-asyncroot directive: mixed re-renderings 1`] = ` "function anonymous(context,extra ) { let utils = this.utils; diff --git a/tests/component.test.ts b/tests/component.test.ts index 4775fbb9..be3b4120 100644 --- a/tests/component.test.ts +++ b/tests/component.test.ts @@ -2354,14 +2354,14 @@ describe("async rendering", () => { expect(destroyCount).toBe(0); }); - test("delayed t-widget with t-async directive", async () => { + test("delayed t-widget with t-asyncroot directive", async () => { env.qweb.addTemplates(`
- +
@@ -2409,13 +2409,13 @@ describe("async rendering", () => { ); }); - test("fast t-widget with t-async directive", async () => { + test("fast t-widget with t-asyncroot directive", async () => { env.qweb.addTemplates(`
- +
@@ -2464,14 +2464,14 @@ describe("async rendering", () => { ); }); - test("t-widget with t-async directive: mixed re-renderings", async () => { + test("t-widget with t-asyncroot directive: mixed re-renderings", async () => { env.qweb.addTemplates(`
- +