When a video cannot be played, the src property never gets set on the video, which leads the componentDidUpdate to run a setState(), setting error to null. When it updates, the source is still undefined, and the setState is called again. This eventually leads to a max depth error and crashes the component.
This PR fixes the issue by checking whether or not the state would actually differ in these cases before attempting to set it.
When a video cannot be played, the
src
property never gets set on the video, which leads thecomponentDidUpdate
to run asetState()
, settingerror
to null. When it updates, the source is still undefined, and thesetState
is called again. This eventually leads to a max depth error and crashes the component.This PR fixes the issue by checking whether or not the state would actually differ in these cases before attempting to set it.