-
Notifications
You must be signed in to change notification settings - Fork 320
Ensure attribute reflected from property is correct #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #592. Ensures a reflecting property set immediately after a corresponding attribute reflects correctly.
kevinpschaaf
left a comment
There was a problem hiding this 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( |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
src/lib/updating-element.ts
Outdated
| // track old value when changing. | ||
| this._changedProperties.set(name, oldValue); | ||
| // add to reflecting properties set | ||
| // Track old value when changing. |
There was a problem hiding this comment.
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.
src/lib/updating-element.ts
Outdated
| 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. |
There was a problem hiding this comment.
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?
Fixes #592. Ensures a reflecting property set immediately after a corresponding attribute reflects correctly.