Skip to content

Commit

Permalink
refactor(engine-core): Remove unnecessary props/attrs assertions (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmdartus authored Jan 14, 2022
1 parent 17dc495 commit c7833d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 1 addition & 8 deletions packages/@lwc/engine-core/src/framework/modules/attrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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];
Expand Down
9 changes: 1 addition & 8 deletions packages/@lwc/engine-core/src/framework/modules/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;

Expand Down

0 comments on commit c7833d3

Please sign in to comment.