[REL] v2.2.6

# v2.2.6

 - [IMP] devtools: add svg elements detection
 - [FIX] reactivity: do not notify for NOOPs on collections
 - [IMP] app: export apps set as static property
 - [IMP] runtime: do not check template equality outside dev mode
 - [FIX] runtime: properly support t-foreach on strings
This commit is contained in:
Géry Debongnie
2023-09-25 13:48:13 +02:00
parent 752160fd85
commit 5dcee2564c
4 changed files with 22 additions and 24 deletions
+19 -21
View File
@@ -2177,7 +2177,7 @@ function delegateAndNotify(setterName, getterName, target) {
if (hadKey !== hasKey) { if (hadKey !== hasKey) {
notifyReactives(target, KEYCHANGES); notifyReactives(target, KEYCHANGES);
} }
if (originalValue !== value) { if (originalValue !== target[getterName](key)) {
notifyReactives(target, key); notifyReactives(target, key);
} }
return ret; return ret;
@@ -2998,15 +2998,13 @@ function prepareList(collection) {
keys = [...collection.keys()]; keys = [...collection.keys()];
values = [...collection.values()]; values = [...collection.values()];
} }
else if (Symbol.iterator in Object(collection)) {
keys = [...collection];
values = keys;
}
else if (collection && typeof collection === "object") { else if (collection && typeof collection === "object") {
if (Symbol.iterator in collection) { values = Object.values(collection);
keys = [...collection]; keys = Object.keys(collection);
values = keys;
}
else {
values = Object.values(collection);
keys = Object.keys(collection);
}
} }
else { else {
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`); throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
@@ -3207,6 +3205,10 @@ class TemplateSet {
} }
addTemplate(name, template) { addTemplate(name, template) {
if (name in this.rawTemplates) { if (name in this.rawTemplates) {
// this check can be expensive, just silently ignore double definitions outside dev mode
if (!this.dev) {
return;
}
const rawTemplate = this.rawTemplates[name]; const rawTemplate = this.rawTemplates[name];
const currentAsString = typeof rawTemplate === "string" const currentAsString = typeof rawTemplate === "string"
? rawTemplate ? rawTemplate
@@ -5553,7 +5555,7 @@ function compile(template, options = {}) {
} }
// do not modify manually. This file is generated by the release script. // do not modify manually. This file is generated by the release script.
const version = "2.2.5"; const version = "2.2.6";
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Scheduler // Scheduler
@@ -5642,13 +5644,8 @@ const DEV_MSG = () => {
This is not suitable for production use. This is not suitable for production use.
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`; See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
}; };
window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = { const apps = new Set();
apps: new Set(), window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = { apps, Fiber, RootFiber, toRaw, reactive });
Fiber: Fiber,
RootFiber: RootFiber,
toRaw: toRaw,
reactive: reactive,
});
class App extends TemplateSet { class App extends TemplateSet {
constructor(Root, config = {}) { constructor(Root, config = {}) {
super(config); super(config);
@@ -5656,7 +5653,7 @@ class App extends TemplateSet {
this.root = null; this.root = null;
this.name = config.name || ""; this.name = config.name || "";
this.Root = Root; this.Root = Root;
window.__OWL_DEVTOOLS__.apps.add(this); apps.add(this);
if (config.test) { if (config.test) {
this.dev = true; this.dev = true;
} }
@@ -5713,7 +5710,7 @@ class App extends TemplateSet {
this.root.destroy(); this.root.destroy();
this.scheduler.processTasks(); this.scheduler.processTasks();
} }
window.__OWL_DEVTOOLS__.apps.delete(this); apps.delete(this);
} }
createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) { createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) {
const isDynamic = !isStatic; const isDynamic = !isStatic;
@@ -5788,6 +5785,7 @@ class App extends TemplateSet {
} }
} }
App.validateTarget = validateTarget; App.validateTarget = validateTarget;
App.apps = apps;
App.version = version; App.version = version;
async function mount(C, target, config = {}) { async function mount(C, target, config = {}) {
return new App(C, config).mount(target, config); return new App(C, config).mount(target, config);
@@ -5986,6 +5984,6 @@ TemplateSet.prototype._compileTemplate = function _compileTemplate(name, templat
export { App, Component, EventBus, OwlError, __info__, blockDom, loadFile, markRaw, markup, mount, onError, onMounted, onPatched, onRendered, onWillDestroy, onWillPatch, onWillRender, onWillStart, onWillUnmount, onWillUpdateProps, reactive, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, validate, validateType, whenReady, xml }; export { App, Component, EventBus, OwlError, __info__, blockDom, loadFile, markRaw, markup, mount, onError, onMounted, onPatched, onRendered, onWillDestroy, onWillPatch, onWillRender, onWillStart, onWillUnmount, onWillUpdateProps, reactive, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, validate, validateType, whenReady, xml };
__info__.date = '2023-08-07T10:26:30.557Z'; __info__.date = '2023-09-25T11:48:01.531Z';
__info__.hash = 'b25e988'; __info__.hash = '752160f';
__info__.url = 'https://github.com/odoo/owl'; __info__.url = 'https://github.com/odoo/owl';
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@odoo/owl", "name": "@odoo/owl",
"version": "2.2.5", "version": "2.2.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@odoo/owl", "name": "@odoo/owl",
"version": "2.2.5", "version": "2.2.6",
"description": "Odoo Web Library (OWL)", "description": "Odoo Web Library (OWL)",
"main": "dist/owl.cjs.js", "main": "dist/owl.cjs.js",
"module": "dist/owl.es.js", "module": "dist/owl.es.js",
+1 -1
View File
@@ -1,2 +1,2 @@
// do not modify manually. This file is generated by the release script. // do not modify manually. This file is generated by the release script.
export const version = "2.2.5"; export const version = "2.2.6";