Skip to content

fix(checkbox): unknown property warning with Ivy during server-side rendering #17485

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

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

crisbeto
Copy link
Member

Ivy's check for whether a property supported is basically if (propName in element) which logs a warning if it doesn't match. It seems like Domino hasn't implemented the indeterminate property for input so Angular ends up logging a warning during server-side rendering. These changes switch to setting the property directly to avoid using a property binding.

Also fixes that the current Material checkbox wasn't coercing the indeterminate input to a boolean.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: major This PR is targeted for the next major release labels Oct 23, 2019
@crisbeto crisbeto added this to the 9.0.0 milestone Oct 23, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 23, 2019
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM in general. Do we actually want to work around this, if it is just a warning?

I'm good working around this (just asking if doing nothing is also an option), but it might be good to submit an issue on the domino repo?

@crisbeto
Copy link
Member Author

IMO we should work around it, because people using our components can't do anything about it if they're rendering on the server.

@devversion
Copy link
Member

Yeah that is true. I guess a todo would be good with a link to an issue on the domino repo. That way, we can remove the workaround if it gets resolved.

@mmalerba
Copy link
Contributor

Yeah I would say file an issue over at https://github.com/fgnass/domino and leave a TODO to clean it up if they fix it

* Syncs the indeterminate value with the checkbox DOM node.
*
* We sync `indeterminate` directly on the DOM node, because in Ivy the check for whether a
* property is supported on an element boils down to `if (propName in element)`. Domino's
Copy link
Member

Choose a reason for hiding this comment

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

Could we file an issue (or send a PR) for Domino and add a TODO here referencing that?

(not sure if there's more to it than adding to the input attrs object)

@crisbeto crisbeto force-pushed the indeterminate-prop-warning branch from 8c04176 to 8c75a17 Compare November 6, 2019 00:34
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Nov 6, 2019
@ngbot
Copy link

ngbot bot commented Nov 6, 2019

I see that you just added the pr: merge ready label, but the following checks are still failing:
    failure status "ci/circleci: lint" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@crisbeto crisbeto force-pushed the indeterminate-prop-warning branch 2 times, most recently from 6a15e89 to 1587c8d Compare November 6, 2019 22:35
@mmalerba
Copy link
Contributor

mmalerba commented Nov 7, 2019

@crisbeto It looks like there's ~4 apps that have checkboxes that now appear indeterminate when they were previously unchecked. Could you split this into 2 PRs, one that fixes the SSR issue and one the fixes the coercion? That should make it easier to get the critical part in.

@mmalerba mmalerba removed the action: merge The PR is ready for merge by the caretaker label Nov 7, 2019
@crisbeto
Copy link
Member Author

crisbeto commented Nov 7, 2019

I don't think there's a way to split it up. We need to change the way we assign the indeterminate value in order to fix the warning.

@mmalerba
Copy link
Contributor

mmalerba commented Nov 7, 2019

Ok, will need to figure out what's going on with those tests before we can merge

@mmalerba mmalerba added action: merge The PR is ready for merge by the caretaker presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged labels Nov 7, 2019
@andrewseguin
Copy link
Contributor

Needs rebase

…endering

Ivy's check for whether a property supported is basically `if (propName in element)` which logs a warning if it doesn't match. It seems like Domino hasn't implemented the `indeterminate` property for `input` so Angular ends up logging a warning during server-side rendering. These changes switch to setting the property directly to avoid using a property binding.

Also fixes that the current Material checkbox wasn't coercing the `indeterminate` input to a boolean.
@crisbeto
Copy link
Member Author

Rebased.

@crisbeto crisbeto force-pushed the indeterminate-prop-warning branch from 1587c8d to c791375 Compare November 12, 2019 21:22
@andrewseguin
Copy link
Contributor

This caused two apps to break since we are now coercing the values. They both had something like [indeterminate]="selected.length && selected.length < values.length). In the case where selected is empty, the input is receiving the value 0 which is now being coerced into true.

@andrewseguin
Copy link
Contributor

Creating fixes for those apps now, and will merge once that is finished

@andrewseguin andrewseguin merged commit 227c490 into angular:master Nov 14, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants