From c7833d379e817c10325f14438497f8b7b251a01f Mon Sep 17 00:00:00 2001 From: Pierre-Marie Dartus Date: Fri, 14 Jan 2022 14:37:57 +0100 Subject: [PATCH] refactor(engine-core): Remove unnecessary props/attrs assertions (#2639) --- packages/@lwc/engine-core/src/framework/modules/attrs.ts | 9 +-------- packages/@lwc/engine-core/src/framework/modules/props.ts | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/@lwc/engine-core/src/framework/modules/attrs.ts b/packages/@lwc/engine-core/src/framework/modules/attrs.ts index c066e9245b..7998cf863c 100644 --- a/packages/@lwc/engine-core/src/framework/modules/attrs.ts +++ b/packages/@lwc/engine-core/src/framework/modules/attrs.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { assert, isNull, isUndefined, keys, StringCharCodeAt } from '@lwc/shared'; +import { isNull, isUndefined, StringCharCodeAt } from '@lwc/shared'; import { setAttribute, removeAttribute } from '../../renderer'; import { VElement } from '../../3rdparty/snabbdom/types'; @@ -27,13 +27,6 @@ export function patchAttributes(oldVnode: VElement | null, vnode: VElement) { return; } - if (process.env.NODE_ENV !== 'production') { - assert.invariant( - oldAttrs === EmptyObject || keys(oldAttrs).join(',') === keys(attrs).join(','), - `vnode.data.attrs cannot change shape.` - ); - } - const { elm } = vnode; for (const key in attrs) { const cur = attrs[key]; diff --git a/packages/@lwc/engine-core/src/framework/modules/props.ts b/packages/@lwc/engine-core/src/framework/modules/props.ts index e8861ac22c..35f1a6f4f4 100644 --- a/packages/@lwc/engine-core/src/framework/modules/props.ts +++ b/packages/@lwc/engine-core/src/framework/modules/props.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { assert, isNull, isUndefined, keys } from '@lwc/shared'; +import { isNull, isUndefined } from '@lwc/shared'; import { getProperty, setProperty } from '../../renderer'; import { VElement } from '../../3rdparty/snabbdom/types'; @@ -28,13 +28,6 @@ export function patchProps(oldVnode: VElement | null, vnode: VElement) { return; } - if (process.env.NODE_ENV !== 'production') { - assert.invariant( - oldProps === EmptyObject || keys(oldProps).join(',') === keys(props).join(','), - 'vnode.data.props cannot change shape.' - ); - } - const isFirstPatch = isNull(oldVnode); const { elm, sel } = vnode;