Apparently a `MenuItem` with a value of `undefined` is possible but
doesn't actually fire a change event. Strange. Use the string `"null"`
instead.
This commit is contained in:
Scott Lamb 2023-02-13 11:05:27 -08:00
parent 64d161d0a7
commit 015dfef9c9
No known key found for this signature in database
2 changed files with 6 additions and 4 deletions

View File

@ -32,6 +32,8 @@ even on minor releases, e.g. `0.7.5` -> `0.7.6`.
* first draft of a web UI for user administration. Rough edges expected!
* `moonfire-nvr login --permissions` now accepts the JSON format documented
in `ref/api.md`, not an undocumented plaintext protobuf format.
* fix [#257](https://github.com/scottlamb/moonfire-nvr/issues/257):
Live View: select None Not Possible After Selecting a Camera.
## 0.7.5 (2022-05-09)

View File

@ -214,17 +214,17 @@ interface MonoviewProps {
/** A single pane of a Multiview, including its camera chooser. */
const Monoview = (props: MonoviewProps) => {
const handleChange = (event: SelectChangeEvent<number | null>) => {
const handleChange = (event: SelectChangeEvent<string>) => {
const {
target: { value },
} = event;
props.onSelect(typeof value === "string" ? parseInt(value) : value);
props.onSelect(value === "null" ? null : parseInt(value));
};
const chooser = (
<Select
value={props.cameraIndex == null ? undefined : props.cameraIndex}
value={props.cameraIndex === null ? "null" : props.cameraIndex.toString()}
onChange={handleChange}
displayEmpty
size="small"
@ -236,7 +236,7 @@ const Monoview = (props: MonoviewProps) => {
},
}}
>
<MenuItem value={undefined}>(none)</MenuItem>
<MenuItem value="null">(none)</MenuItem>
{props.cameras.map((e, i) => (
<MenuItem key={i} value={i}>
{e.shortName}