mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REL] v2.2.9
# v2.2.9 - [IMP] reactivity: replace sets with small arrays for performance
This commit is contained in:
+8
-7
@@ -1850,8 +1850,9 @@ const NO_CALLBACK = () => {
|
|||||||
};
|
};
|
||||||
const objectToString = Object.prototype.toString;
|
const objectToString = Object.prototype.toString;
|
||||||
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
const SUPPORTED_RAW_TYPES = new Set(["Object", "Array", "Set", "Map", "WeakMap"]);
|
// Use arrays because Array.includes is faster than Set.has for small arrays
|
||||||
const COLLECTION_RAWTYPES = new Set(["Set", "Map", "WeakMap"]);
|
const SUPPORTED_RAW_TYPES = ["Object", "Array", "Set", "Map", "WeakMap"];
|
||||||
|
const COLLECTION_RAW_TYPES = ["Set", "Map", "WeakMap"];
|
||||||
/**
|
/**
|
||||||
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
||||||
* many native objects such as Promise (whose toString is [object Promise])
|
* many native objects such as Promise (whose toString is [object Promise])
|
||||||
@@ -1874,7 +1875,7 @@ function canBeMadeReactive(value) {
|
|||||||
if (typeof value !== "object") {
|
if (typeof value !== "object") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return SUPPORTED_RAW_TYPES.has(rawType(value));
|
return SUPPORTED_RAW_TYPES.includes(rawType(value));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a reactive from the given object/callback if possible and returns it,
|
* Creates a reactive from the given object/callback if possible and returns it,
|
||||||
@@ -2044,7 +2045,7 @@ function reactive(target, callback = NO_CALLBACK) {
|
|||||||
const reactivesForTarget = reactiveCache.get(target);
|
const reactivesForTarget = reactiveCache.get(target);
|
||||||
if (!reactivesForTarget.has(callback)) {
|
if (!reactivesForTarget.has(callback)) {
|
||||||
const targetRawType = rawType(target);
|
const targetRawType = rawType(target);
|
||||||
const handler = COLLECTION_RAWTYPES.has(targetRawType)
|
const handler = COLLECTION_RAW_TYPES.includes(targetRawType)
|
||||||
? collectionsProxyHandler(target, callback, targetRawType)
|
? collectionsProxyHandler(target, callback, targetRawType)
|
||||||
: basicProxyHandler(callback);
|
: basicProxyHandler(callback);
|
||||||
const proxy = new Proxy(target, handler);
|
const proxy = new Proxy(target, handler);
|
||||||
@@ -5537,7 +5538,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.8";
|
const version = "2.2.9";
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Scheduler
|
// Scheduler
|
||||||
@@ -5966,6 +5967,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 = '2024-01-12T10:02:46.131Z';
|
__info__.date = '2024-01-12T14:43:56.804Z';
|
||||||
__info__.hash = '7b454da';
|
__info__.hash = '7b3e39b';
|
||||||
__info__.url = 'https://github.com/odoo/owl';
|
__info__.url = 'https://github.com/odoo/owl';
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odoo/owl",
|
"name": "@odoo/owl",
|
||||||
"version": "2.2.8",
|
"version": "2.2.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odoo/owl",
|
"name": "@odoo/owl",
|
||||||
"version": "2.2.8",
|
"version": "2.2.9",
|
||||||
"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
@@ -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.8";
|
export const version = "2.2.9";
|
||||||
|
|||||||
Reference in New Issue
Block a user