Skip to content

Commit

Permalink
Revert "Ensure that diff property call backs are called immediately w…
Browse files Browse the repository at this point in the history
…hen registered (dojo#572)"

This reverts commit b8b4678.
  • Loading branch information
agubler committed Nov 5, 2019
1 parent b8b4678 commit bf444fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion src/core/vdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ export const diffProperty = factory(({ id }) => {
widgetMeta.customDiffProperties = widgetMeta.customDiffProperties || new Set();
const propertyDiffMap = widgetMeta.customDiffMap.get(id) || new Map();
if (!propertyDiffMap.has(propertyName)) {
diff({}, widgetMeta.properties);
propertyDiffMap.set(propertyName, diff);
widgetMeta.customDiffProperties.add(propertyName);
}
Expand Down
20 changes: 1 addition & 19 deletions tests/core/unit/vdom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3790,6 +3790,7 @@ jsdomDescribe('vdom', () => {
let counter = 0;
const Foo = createWidget(({ middleware }) => {
middleware.diffProperty('key', (current: any, properties: any) => {
assert.deepEqual(current, { key: 'foo' });
assert.deepEqual(properties, { key: 'foo' });
middleware.invalidator();
});
Expand Down Expand Up @@ -3840,25 +3841,6 @@ jsdomDescribe('vdom', () => {
resolvers.resolve();
assert.strictEqual(root.outerHTML, '<div><div><button></button><div>first</div></div></div>');
});

it('should call diff property for the first render', () => {
const createWidget = create({ diffProperty });
let counter = 0;
const Foo = createWidget(({ middleware }) => {
middleware.diffProperty('key', () => {
counter++;
});
return v('div', [`${counter}`]);
});
const App = createWidget(() => {
return v('div', [v('button', {}), Foo({ key: 'foo' })]);
});
const r = renderer(() => App({}));
const root = document.createElement('div');
r.mount({ domNode: root });
assert.strictEqual(root.outerHTML, '<div><div><button></button><div>1</div></div></div>');
sendEvent(root.childNodes[0].childNodes[0] as HTMLButtonElement, 'click');
});
});
});
});
Expand Down

0 comments on commit bf444fd

Please sign in to comment.