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
fix(elements): handle falsy initial value #31604
fix(elements): handle falsy initial value #31604
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
@@ -165,7 +165,7 @@ export class ComponentNgElementStrategy implements NgElementStrategy { | |||
protected initializeInputs(): void { | |||
this.componentFactory.inputs.forEach(({propName}) => { | |||
const initialValue = this.initialInputValues.get(propName); | |||
if (initialValue) { | |||
if (typeof initialValue !== 'undefined') { |
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 if the property is explicitly set to undefined
? How about checking with this.initialInputValue.has(propName)
instead?
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.
Right, good idea. To achieve this, I had to put caching (f4ccdf9#diff-c0d4cfddef0e50ed399624e91049d934R128) above checking the value via strictEquals
to make sure we store it even if it's undefined
. Please review and confirm if it's okay.
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.
Thx, @merobal! Can you, please squash the two commits together?
f4ccdf9
to
fc13e73
Compare
@gkalpak done |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #30834
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #30834
What is the new behavior?
Does this PR introduce a breaking change?
Other information