Closed danielr18 closed 5 years ago
I understand the checks for MaybeMarquee
and VideoDisplay
since they rely on MutationObserver
, but I'm wondering why we have checks in ProgressBar
and VolumeControl
. According to MDN appendChild
and addEventListener
are each supported in IE9, which is the minimum browser version that React 16 supports. Do you have a case where this helps you?
For the checks we do include, I would like comments similar to those for the last PR. It would be sufficient to reference the componentWillUnmount
of PlayerContextProvider
(like so: https://github.com/benwiley4000/cassette/blob/next/packages/core/src/PlayerContextProvider.js#L1043).
I actually made this PR because I got at error in ProgressBar
, caused by this.noselectStyleElement
not being defined, my guess is that because it's set on the setTimeout
, when another component's componentDidMount fails, the boundary unmounts all component, and the callback that defines this.noselectStyleElement
is not called.
The one in VideoDisplay
was just in case to be honest, but it should always be set by the time componentWillUnmount
is called, I'll remove it.
Ah, that makes sense. I'd guess the timeout callback actually does get called, but it happens after unmount if you unmount it synchronously following the error boundary lifecycle hook.
Could you include a note about what we discussed above in the comment for ProgressBar's check? I just want to make sure it's clear why we think the style element could be missing.
I've just added the comments
I think there's a couple things I should reword slightly but I'll do that after merging. Thank you for this!!
@danielr18 did you experience problems with MaybeMarquee
or VideoDisplay
specifically? I just looked at the readme for the ResizeObserver polyfill and it says it falls back to mutation events if the MutationObserver isn't supported. https://github.com/que-etc/resize-observer-polyfill So if there are issues I'm wondering what would cause them. The polyfill is supposed to support IE9 and up.
Published in 2.0.0-alpha.19 ☺️
My bad regarding ResizeObserver
, I forgot that it was using the polyfill. I haven't had any issues logged yet regarding ResizeObserver
.
No worries, thank you for clarifying. I missed it too. :slightly_smiling_face: And the checks didn't hurt anything.
I just reverted that part of the change and released a new version (alpha.20). Of course let me know if you run into other issues.
Similar to #342, but for the rest of components that use
componentWillUnmount
, it makes sure that the variables exist before doing their cleaning.