fix #157: problem with live multi-camera selection

When you select the first camera in the drop-down on a grid square
that isn't the top left, then select a camera in the top-left, it
behaves strangely.

The root cause is that I had a dumb mistake in how I assigned React
keys. I used the camera index when a camera is selected, and the
inverse of the selected index when one is. But 0 == -0!
This commit is contained in:
Scott Lamb 2021-08-31 16:20:24 -07:00
parent 0a38044b02
commit d2c7b62771
1 changed files with 2 additions and 2 deletions

View File

@ -164,8 +164,8 @@ const Multiview = (props: MultiviewProps) => {
// WebSocket connections and buffers.
//
// When no camera is selected, use the index within selected. (Actually,
// its negation, to disambiguate between the two cases.)
const key = e ?? -i;
// -1 minus the index, to disambiguate between the two cases.)
const key = e ?? -1 - i;
return (
<Monoview
key={key}