Skip to content

When editing detection zones, snapshots initially load, but are replaced with a plain grid after 10 seconds #622

Closed

Description

@irichter

When editing zones for a stream, initially the snapshot image will initially load correctly. It then disappears within 10 seconds and is replaced with a grid and the notice "Snapshot unavailable - drawing on grid background".

Root Cause

The setTimeout() closure at ZoneEditor.jsx:95 captures imageLoaded when the closure is created. When setImageLoaded() is called, a new render is made, but the closure is not replaced. imageLoaded evaluates to false and the snapshot gets removed.

Possible Fixes

  1. Cancel the timeout (clearTimeout()) when the image successfully loads
  2. Modify the closure and/or utilize useEffect to check the current value of imageLoaded at the time that the closure runs -- see examples in https://stackoverflow.com/questions/73697416/react-stale-usestate-value-in-closure-how-to-fix

Activity

  1. matteius commented on Oct 4, 2026

    @matteius
    Contributor

    Fixed on main in f11b56f: the zone editor now cancels the 10-second fallback timer when the snapshot loads or fails, so a successful snapshot is not replaced by the grid. The production web build passes. I am leaving this open until it is available in a release and you can confirm it with your camera.

  2. irichter commented on Oct 9, 2026

    @irichter
    Author

    The fix works for me on 0.42.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions