Skip to content

React 18 Strict mode breaks camera - stuck on "Loading"  #196

@MikiMullorXjump

Description

@MikiMullorXjump

Under Strict Mode, isCameraOn state prop doesn't set to true, therefore breaking downstream the capture of video

Line 333 in video-recorder.js:

handleSuccess = (stream) => {
// Since handleSuccess is an async function, we may be in a situation where this was called after the
// component was unmounted
if (this.isComponentUnmounted) {
return
}

isComponentUnmounted is true when Reacts mounts the second time in strict mode.

This prevents setting isCameraOn to true

It's a race condition somewhere.

disabling strict mode "fixes" the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions