-
Notifications
You must be signed in to change notification settings - Fork 30
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
WRQ-24303: Fix marqueeDecorator
and marqueeController
to start animation properly when content changed
#3247
Conversation
…perly when content changed. Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3247 +/- ##
===========================================
- Coverage 82.48% 82.45% -0.04%
===========================================
Files 157 157
Lines 7247 7251 +4
Branches 1919 1923 +4
===========================================
+ Hits 5978 5979 +1
- Misses 998 1000 +2
- Partials 271 272 +1 ☔ View full report in Codecov by Sentry. |
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
marqueeDecorator
and marqueeController
to start animation properly when content changed.marqueeDecorator
and marqueeController
to start animation properly when content changed
Since the patch is implemented in cancelJob which is called with setTimeout, I cannot add unit test of it. |
@@ -193,7 +196,7 @@ const useMarqueeController = (props) => { | |||
*/ | |||
const handleComplete = useCallback((component) => { | |||
const complete = markReady(component); | |||
if (complete) { | |||
if (complete && !component.contentFits) { |
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.
I think we can have this change in develop branch, but we need to discuss when we make a change to deployed one.
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.
Okay I agree.
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
Enact-DCO-1.0-Signed-off-by: Mikyung Kim (mikyung27.kim@lge.com)
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.
LGTM
Let's add 'restart' function to MarqueeDecorator.js that simply calls 'restartAnimation' for consistent API sets. Looks great except this. |
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
It's fixed :) |
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
Checked codecov results and it looks okay. |
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
Checklist
Issue Resolved / Feature Added
When is wrapped with MarqueeController to be synchronized and marqueeOn props is 'render' and the content changes, MarqueeDecorator cannot start the marquee animation.
Resolution
MarqueeDecorator.componentDidUpdate()
called when content changed.As children is changed,
this.invalidateMetrics()
,this.cancelAnimation()
are called andforceRestartMarquee
variable set to true incomponentDidUpdate
function,this.tryStartingAnimation()
function is called becauseforceRestartMarquee
is true.However, In
tryStartingAnimation()
, it returns without callingstartAnimation()
function becuasethis.timerState
is 1(=TimerState.START_PENDING).this.timerState
is set to 1 inMarqueeDecorator.start()
function which is called beforecomponentDidUpdate
.So I added
retryStartingAnimation
flag inMarqueeDecorator.cancelAnimation()
to check whether we need to restartAnimation after cancelJob completes.Additional Considerations
In additional, I think handleComplete in useMarqueeController needs to be fixed too.
When is wrapped with a MarqueeController, I found that the MarqueeDecorator.start function is constantly being called, even though content is short that doesn't need to be animate.
Links
WRQ-24303
Comments