Skip to content
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

Closed

Conversation

@merobal
Copy link
Contributor

commented Jul 17, 2019

Fixes #30834

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #30834

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@merobal merobal requested a review from angular/fw-elements as a code owner Jul 17, 2019

@googlebot

This comment has been minimized.

Copy link

commented Jul 17, 2019

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.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no label Jul 17, 2019

@merobal

This comment has been minimized.

Copy link
Contributor Author

commented Jul 17, 2019

I signed it!

@googlebot

This comment has been minimized.

Copy link

commented Jul 17, 2019

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Jul 17, 2019

@@ -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') {

This comment has been minimized.

Copy link
@gkalpak

gkalpak Jul 17, 2019

Member

What if the property is explicitly set to undefined? How about checking with this.initialInputValue.has(propName) instead?

This comment has been minimized.

Copy link
@merobal

merobal Jul 17, 2019

Author Contributor

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.

@ngbot ngbot bot added this to the needsTriage milestone Jul 17, 2019

@gkalpak
Copy link
Member

left a comment

Thx, @merobal! Can you, please squash the two commits together?

@merobal merobal force-pushed the merobal:fix-initial-falsy-values-for-elements branch from f4ccdf9 to fc13e73 Jul 18, 2019

@merobal

This comment has been minimized.

Copy link
Contributor Author

commented Jul 18, 2019

@gkalpak done

@mhevery

This comment has been minimized.

@mhevery mhevery closed this in 7151eae Jul 18, 2019

mhevery added a commit that referenced this pull request Jul 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.