Skip to content

Commit

Permalink
wip: address review comments
Browse files Browse the repository at this point in the history
and run performance
  • Loading branch information
jodarove committed Sep 21, 2019
1 parent 02306d5 commit 4ba32d2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/@lwc/engine/src/framework/base-lightning-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import { ViewModelReflection, EmptyObject } from './utils';
import { vmBeingConstructed, isBeingConstructed, isRendering, vmBeingRendered } from './invoker';
import { getComponentVM, VM } from './vm';
import { valueMutated, valueObserved } from './mutation-tracker';
import { componentValueMutated, valueObserved } from './mutation-tracker';
import { dispatchEvent } from '../env/dom';
import { patchComponentWithRestrictions, patchShadowRootWithRestrictions } from './restrictions';
import { unlockAttribute, lockAttribute } from './attributes';
Expand Down Expand Up @@ -116,7 +116,7 @@ function createBridgeToElementDescriptor(
if (newValue !== vm.cmpProps[propName]) {
vm.cmpProps[propName] = newValue;

valueMutated(vm, propName);
componentValueMutated(vm, propName);
}
return set.call(vm.elm, newValue);
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/engine/src/framework/decorators/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { assert, isFunction, toString } from '@lwc/shared';
import { logError } from '../../shared/assert';
import { isRendering, vmBeingRendered, isBeingConstructed } from '../invoker';
import { valueObserved, valueMutated } from '../mutation-tracker';
import { valueObserved, componentValueMutated } from '../mutation-tracker';
import { ComponentInterface } from '../component';
import { getComponentVM } from '../vm';

Expand Down Expand Up @@ -59,7 +59,7 @@ export function createPublicPropertyDescriptor(key: string): PropertyDescriptor
}
vm.cmpProps[key] = newValue;

valueMutated(vm, key);
componentValueMutated(vm, key);
},
enumerable: true,
configurable: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/engine/src/framework/decorators/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { assert } from '@lwc/shared';
import { isRendering, vmBeingRendered } from '../invoker';
import { valueObserved, valueMutated } from '../mutation-tracker';
import { valueObserved, componentValueMutated } from '../mutation-tracker';
import { getComponentVM } from '../vm';
import { reactiveMembrane } from '../membrane';
import { ComponentInterface } from '../component';
Expand Down Expand Up @@ -54,7 +54,7 @@ export function internalTrackDecorator(key: string): PropertyDescriptor {
if (reactiveOrAnyValue !== vm.cmpFields[key]) {
vm.cmpFields[key] = reactiveOrAnyValue;

valueMutated(vm, key);
componentValueMutated(vm, key);
}
},
enumerable: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/engine/src/framework/membrane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import ObservableMembrane from 'observable-membrane';
import { valueObserved, valueMutated } from '../libs/mutation-tracker';
import { valueObserved, valueMutated } from './mutation-tracker';

function valueDistortion(value: any) {
return value;
Expand Down
18 changes: 10 additions & 8 deletions packages/@lwc/engine/src/framework/mutation-tracker.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import {
valueMutated as mtValueMutated,
valueObserved,
ReactiveObserver,
} from '../libs/mutation-tracker';
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { valueMutated } from '../libs/mutation-tracker';
import { VM } from './vm';
// import { isFalse } from "@lwc/shared";

export function valueMutated(vm: VM, key: PropertyKey) {
export function componentValueMutated(vm: VM, key: PropertyKey) {
const { component } = vm;
// if (isFalse(vm.isDirty)) {
mtValueMutated(component, key);
valueMutated(component, key);
// }
}

export { valueObserved, ReactiveObserver };
export * from '../libs/mutation-tracker';
4 changes: 2 additions & 2 deletions packages/@lwc/engine/src/framework/observed-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { assert } from '@lwc/shared';
import { ComponentInterface } from './component';
import { getComponentVM } from './vm';
import { valueMutated, valueObserved } from './mutation-tracker';
import { componentValueMutated, valueObserved } from './mutation-tracker';

export function createObservedFieldPropertyDescriptor(key: string): PropertyDescriptor {
return {
Expand All @@ -28,7 +28,7 @@ export function createObservedFieldPropertyDescriptor(key: string): PropertyDesc
if (newValue !== vm.cmpFields[key]) {
vm.cmpFields[key] = newValue;

valueMutated(vm, key);
componentValueMutated(vm, key);
}
},
enumerable: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/engine/src/framework/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { assert, isUndefined, ArrayPush, getOwnPropertyNames } from '@lwc/shared';
import { ComponentInterface } from './component';
import { valueMutated, ReactiveObserver } from './mutation-tracker';
import { componentValueMutated, ReactiveObserver } from './mutation-tracker';
import { VM, runWithBoundaryProtection } from './vm';
import { invokeComponentCallback } from './invoker';
import { dispatchEvent } from '../env/dom';
Expand All @@ -21,7 +21,7 @@ function createFieldDataCallback(vm: VM, name: string) {
// storing the value in the underlying storage
cmpFields[name] = value;

valueMutated(vm, name);
componentValueMutated(vm, name);
}
};
}
Expand Down

0 comments on commit 4ba32d2

Please sign in to comment.