Skip to content

Commit 54d5dcc

Browse files
fix(FEC-12373): Web][UI][Chrome][Safari] Seek buttons don't spin after clicking on it for the second time
Before 3b22ffc, when with-animation's componentDidMount was called, the child ref was already set, but the change in the timing of setIsLive caused it to now be null at that point, so it's not possible to register an event listener for child events. To avoid the issue, I've moved with-animation's event handling into animate, where the child ref is already set.
1 parent 587484d commit 54d5dcc

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/utils/with-animation.js

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,16 @@ export const withAnimation: Function = (cssClass: string) => (WrappedComponent:
1212
ref = createRef();
1313

1414
/**
15-
* When component is mounted create event manager instance.
16-
* @returns {void}
17-
*
18-
* @memberof AnimationComponent
19-
*/
20-
componentDidMount(): void {
21-
if (!this.ref.current) return;
22-
this.props.eventManager.listen(this.ref.current, 'animationend', () => {
23-
this.ref.current.classList.remove(cssClass);
24-
});
25-
}
26-
/**
27-
* Before component is unmounted remove all event manager listeners.
28-
* @returns {void}
29-
*∏
30-
* @memberof AnimationComponent
31-
*/
32-
componentWillUnmount(): void {
33-
if (!this.ref.current) return;
34-
this.ref.current.classList.remove(cssClass);
35-
}
36-
37-
/**
38-
* adds the animation class
15+
* add the animation class, then remove it on animation end
3916
* @returns {void}
4017
* @memberof AnimationComponent
4118
*/
4219
animate = (): void => {
4320
if (!this.ref.current) return;
4421
this.ref.current.classList.add(cssClass);
22+
this.props.eventManager.listenOnce(this.ref.current, 'animationend', () => {
23+
this.ref.current.classList.remove(cssClass);
24+
});
4525
};
4626

4727
/**

0 commit comments

Comments
 (0)