-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(animations): change throw -> trace to avoid unnecessary app crash #5475
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): change throw -> trace to avoid unnecessary app crash #5475
Conversation
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Hey Nathan, Trying to |
Thanks @vakrilov - we always check A brief inspection of https://stackoverflow.com/a/77164
@vakrilov Is this animation condition truly exceptional?
The framework core currently makes developing bug free apps more difficult due to the extraneous and voluminous usage of What do you recommend? |
Hey @NathanWalker Looking at the crash analysis report you've attached - it is the exception thrown in As for throwing exceptions in general - I absolutely agree that exceptions should not be used as a control flow mechanism. Non of that APIs in the core framework are designed in a way that requires you to catch exceptions in order achieve your goal. What we do use as a guiding principle when writing code is fail early/fail early. Most of the That said, I don't agree that judging the quality and ergonomics of a framework, based on the number of throws in the code is fair. |
14b2a83
to
2ef8cf2
Compare
Thank you for the understanding @vakrilov and pointing out keyframe-animation.ts file, likely the worst offender since CSS animation issues have been reported by others in several other outlets (forums,issues,etc.). I have updated the PR to include an adequate fix for that file as well. Big believer in fail fast/fail early however around animation handling doing the correct thing to help a sequence continue/succeed vs. fail is a far better route to take. Consider the comment in the SO post you mentioned:
The browser vendors do the right thing. Here we want to help an animation sequence/condition continue while still allowing the developer to dive deeper by turning tracing on to gain deeper insight if they need to. An appreciated priority would be on ensuring dev's can create animations via CSS keyframes or otherwise without coming to find out some 1% of users find a path that was impossible to find during testing and worse not even fixable by the developer themselves as is the case here since it is coming from the core framework in use. 1% of a 1.5 million user base is 15,000 users that were adversely affected by the Please let me know if there are other concerns to these changes and I can adjust per your advice. |
2ef8cf2
to
9c3b041
Compare
traceWrite("Animation is already playing.", traceCategories.Animation, 2); | ||
} | ||
return <AnimationPromiseDefinition>new Promise<void>((resolve, reject) => { | ||
reject(); |
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.
Can you add Animation is already playing.
as a reason for rejecting.
traceWrite("Keyframe animation is already playing.", traceCategories.Animation, 2); | ||
} | ||
return new Promise<void>((resolve, reject) => { | ||
reject(); |
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.
Can you add Keyframe animation is already playing
as a reason for rejecting
Hey thanks for your explanations. I have run the CI tests. Can I ask you to write a couple of unit tests (probably in
|
9c3b041
to
1d7fac2
Compare
Fixes major cause of crashes/bugs in production apps using animation.
1d7fac2
to
61937a2
Compare
Any way we could see this in a hotfix release? This appears to have been a regression in 3.4.x. I had none of these before 3.4, but 3.4 seems to have surfaced this and I'm seeing it at around a ~2% user rate in production. I'd be happy to take an |
@NathanWalker the unit tests you have written seem to fail now on Android (that's what test do). Indeed that was helpful because seems there is something we've missed. There is a platform-specific implementation for both |
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.
You can slip these // >>
comments in the tests. They are not related to testing, we use them to generate code snippets for the docs from the wrapped sections.
Ok excellent I’ll fix that up tomorrow since I’m going to bed now. If you knew the fix and wanted to pull my branch to finish it up would be fine, otherwise I’ll get in morning. |
* chore(tests): Cleanup code snippets comments * refactor(animations): Plat-specific cancel and play methods refactored
Perfection thank you 👍 |
test |
This addition adds more insight into iOS crashes, especially for failures in JS that result in the crash. Using this logging we were able to identify this issue: NativeScript/NativeScript#5475 which otherwise would have been impossible to trace, as it had a 5% repro among users but never occurred internally.
@vakrilov I'm unable to see the jenkins test detail - just lemme know if any other modifications are needed to get those to clear 👍 - thanks again. |
test branch_animations#master |
Hey @NathanWalker we are currently investigating the failed tests from the CI and I need some time. I just want to let you know that we are working on it. Most probably the issue is not related to this PR but I need to be sure. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes cause of crashes/bugs in production apps using animation.
PR Checklist
What is the current behavior?
Developers create apps using animation library and under normal circumstances and well coded scenarios the app will
throw
when navigating or other normal app usage causing bugginess.What is the new behavior?
Developers can now see the warning in the console when developing if tracing is enabled to let them know but keep their app stable.
Cause of instability in production Portable North Pole
See screenshot of Crashlytics reports on this.
/cc @atanasovg @vakrilov @sis0k0 @DickSmith