Skip to content

Conversation

@sorvell
Copy link
Member

@sorvell sorvell commented Mar 12, 2019

Fixes #592. Ensures a reflecting property set immediately after a corresponding attribute reflects correctly.

Fixes #592. Ensures a reflecting property set immediately after a corresponding attribute reflects correctly.
Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const ctor = this.constructor as typeof UpdatingElement;
const options =
ctor._classProperties!.get(name) || defaultPropertyDeclaration;
if (ctor._valueHasChanged(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to PR, but why do we pass options.hasChanged through a static method that just calls it? It's private so it can't be overridden by user...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we intend to make this overridable at some point.

// track old value when changing.
this._changedProperties.set(name, oldValue);
// add to reflecting properties set
// Track old value when changing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This reads more like a "what" comment than a "why". It'd be nice to either say why we only record the once, or remove the comment since the code seems pretty self-documenting on what it's doing.

this._reflectingProperties.set(name, options);
}
// abort the request if the property should not be considered changed.
// Abort the request if the property should not be considered changed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what line is this commenting? The last line of the if case or the else case?

@sorvell sorvell merged commit 34c9568 into master Mar 14, 2019
@sorvell sorvell deleted the attribute-property-refect branch March 14, 2019 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants