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(animations): allow animations with unsupported CSS properties #44729

Conversation

dario-piotrowicz
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz commented Jan 16, 2022

currently animations with unsupported CSS properties cause a hard error
and the crash of the animation itself, instead of this behaviour just
ignore such properties and provide a warning for the developer in
the console (only in dev mode)

resolves #23195

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:

Issue

Issue Number: #23195

Does this PR introduce a breaking change?

  • Yes
  • No

I don't think it's a breaking change, unless someone was actually in some circumstances relying on the animations crushing when finding unsupported CSS properties 🤔

Other information

You can notice that the warnings I've added are strings which is inconsistent with the errors being anys, I believe the errors should actually also be strings and I've already opened #44726 to update their type 🙂

@pullapprove pullapprove bot requested a review from jelbourn January 16, 2022 11:42
@ngbot ngbot bot added this to the Backlog milestone Jan 18, 2022
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

Thanks, @dario-piotrowicz! I like this a lot. Definitely take a look at the comment below. One thing I've been thinking about as I read this is that there's similar code used every time you output them to console.warn. This suggests to me maybe an abstraction makes sense. What do you think?

@dario-piotrowicz
Copy link
Contributor Author

Thanks, @dario-piotrowicz! I like this a lot. Definitely take a look at the comment below. One thing I've been thinking about as I read this is that there's similar code used every time you output them to console.warn. This suggests to me maybe an abstraction makes sense. What do you think?

Thanks! 😃

Yes an abstraction would make total sense, the issue is that if you look at the console.warns they are not all the same, I am actually following what the errors do (before each of my console.warns you can see an error being thrown and that I am generating the warning string in the same manner as the error throw).

I am not sure why they are different and figured the safest thing would be to follow that for the introduction of warnings, but I could definitely abstract the console warnings in some reusable way and then we can pick the errors up separately?

or would it make sense to just keep the warnings as they are for this PR and abstract both errors and warnings at the same time in a separate PR? 🤔

regardless there are many ways these errors can pop up, I haven't really tried triggering them all, I will have to have an investigation in this too to see if there is a reason we have different formats for errors in different places or not (probably not, but still would be good to have a look around I think 😄)

@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch from 5767268 to 29114a0 Compare January 19, 2022 21:29
@dario-piotrowicz
Copy link
Contributor Author

@jessicajaniuk I've looked into the errors and they are all just results of buildAnimationAst calls, so it doesn't really look like there is any reason to present them differently (on the contrary, it would be good to display them in a consistent format)

So I'll add a commit to add some shared functionality for the errors and warnings 🙂👍

@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch from ce516ae to 6875003 Compare January 22, 2022 20:35
@dario-piotrowicz
Copy link
Contributor Author

dario-piotrowicz commented Jan 22, 2022

@jessicajaniuk I've added shared functions for both the errors throwing and the warnings logging, please have a look 😄


By the way, I originally added the new functions to the util.ts file but that didn't work as it would create a circular dependency:
Screenshot at 2022-01-22 21-34-38

The issue is that currently browser/src/util.ts depends on the browser/src/render/shared.ts which to me seems quite wrong, the dependency seems to be of a single function (isNode) so just moving that into util should solve things 🤔 , what do you think @jessicajaniuk? if you agree with the change, would it be ok if I just added a todo comment to make the change in this PR and do the actual refactoring in a follow-up PR? (just to try not to increase the scope of the current one)

@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch 5 times, most recently from 84d2e67 to a0668f8 Compare January 24, 2022 20:44
@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch from a0668f8 to bac79f9 Compare January 31, 2022 21:14
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

@dario-piotrowicz I managed to break this again with the Error tree shaking pull request. So you'll want to take a look again. We'll want to be sure that warnings are also tree shakable, as well. Definitely take a look and let me know if you need any pointers. I'm pretty sure we can still get this in the v14 release.

@dario-piotrowicz
Copy link
Contributor Author

dario-piotrowicz commented Feb 12, 2022

@jessicajaniuk PR fixed, for the warning I tried to follow what you did for the errors in the way that made more sense to me, hopefully I got it right, please let me know what you think 🙂


PS: there were so many things to change that I just force-pushed a single commit in and cleared all the rest, sorry if it creates any inconvenience 🙇

@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch 2 times, most recently from c541a9f to d67e6c7 Compare February 13, 2022 11:20
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

@dario-piotrowicz This is super close. I like the changes, and I have a few suggestions for making it a bit cleaner here. Should be very quick to address and we should be able to land it.

packages/animations/browser/src/warning_helpers.ts Outdated Show resolved Hide resolved
packages/animations/browser/test/shared.ts Outdated Show resolved Hide resolved
packages/animations/browser/src/warnings.ts Outdated Show resolved Hide resolved
@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch 2 times, most recently from 2750894 to e92ee0f Compare February 16, 2022 20:30
@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch from e92ee0f to 0c776eb Compare February 16, 2022 20:47
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

LGTM 🍪

Thanks for working through this, @dario-piotrowicz!

@jessicajaniuk jessicajaniuk removed the request for review from jelbourn February 16, 2022 23:46
@dario-piotrowicz
Copy link
Contributor Author

LGTM cookie

Thanks for working through this, @dario-piotrowicz!

Thank you for the awesome reviewing, sorry I went in the wrong direction a couple of times! 😜

@jessicajaniuk jessicajaniuk added target: patch This PR is targeted for the next patch release action: presubmit The PR is in need of a google3 presubmit action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Feb 17, 2022
@alxhub
Copy link
Member

alxhub commented Feb 18, 2022

@dario-piotrowicz currently this is tagged as feat, meaning it won't be mergeable into the 13.2.x branch. However, this definitely feels like a bugfix instead. Should we update the commit tag and land this as a fix?

@alxhub alxhub added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Feb 18, 2022
@dario-piotrowicz
Copy link
Contributor Author

@dario-piotrowicz currently this is tagged as feat, meaning it won't be mergeable into the 13.2.x branch. However, this definitely feels like a bugfix instead. Should we update the commit tag and land this as a fix?

Sorry I am not really sure.... the original code was purposely stopping animations for unsupported properties, and I changed it to ignore them instead... so it does sort of sound like a feature (even if a very small one) 🤷

I don't even know what difference it makes to land this as a feat or a bugfix, I guess I don't mind either way, please let me know what you think/suggest

(@jessicajaniuk, what do you think? 🙂)

currently animations with unsupported CSS properties cause a hard error
and the crash of the animation itself, instead of this behaviour just
ignore such properties and provide a warning for the developer in
the console (only in dev mode)

this change also introduces a general way to present warnings
in the animations code

resolves angular#23195
@dario-piotrowicz dario-piotrowicz force-pushed the animations-skip-unsupported-css-properties branch from 20902d2 to 8cface7 Compare February 22, 2022 20:58
@dario-piotrowicz
Copy link
Contributor Author

@alxhub Updated to fix 🙂👍

@dario-piotrowicz dario-piotrowicz changed the title feat(animations): allow animations with unsupported CSS properties fix(animations): allow animations with unsupported CSS properties Feb 22, 2022
@jessicajaniuk jessicajaniuk added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: presubmit The PR is in need of a google3 presubmit labels Feb 22, 2022
@atscott
Copy link
Contributor

atscott commented Feb 23, 2022

FYI - This had a conflict with 13.2.x. Please open a new PR to target that branch only.

@atscott atscott added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Feb 23, 2022
@atscott
Copy link
Contributor

atscott commented Feb 23, 2022

This PR was merged into the repository by commit f8dc660.

@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 Mar 26, 2022
josmar-crwdstffng pushed a commit to josmar-crwdstffng/angular that referenced this pull request Apr 8, 2022
…gular#44729)

currently animations with unsupported CSS properties cause a hard error
and the crash of the animation itself, instead of this behaviour just
ignore such properties and provide a warning for the developer in
the console (only in dev mode)

this change also introduces a general way to present warnings
in the animations code

resolves angular#23195

PR Close angular#44729
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 area: animations target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animations shouldn't crash for unrecognized CSS properties but should just ignore them
5 participants