mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-24 05:03:16 -05:00
fix #79: errors when "infinite" selected on load
I've never seen this happen in Chrome; each load/reload starts fresh, so infinite is never selected. But on Firefox it seems to remember the setting across reloads, triggering this bug. This bug was introduced in 58152e8: it started parsing/normalizing the HTML form into a Javascript field on change. It didn't handle the initial load properly. Prior to that commit, fetch() simply read directly from the HTML form, so it didn't care about initial vs update.
This commit is contained in:
parent
2b7a3a31e2
commit
1fe5ef8e94
@ -84,11 +84,11 @@ export default class NVRSettingsView {
|
||||
*/
|
||||
wireControls_() {
|
||||
const videoLengthEl = $(`#${this.ids_.videoLenId}`);
|
||||
this.videoLength_ = this.findSelectedOrFirst_(videoLengthEl);
|
||||
|
||||
function normalize(v) { return v == 'infinite' ? Infinity : Number(v); }
|
||||
this.videoLength_ = normalize(this.findSelectedOrFirst_(videoLengthEl));
|
||||
videoLengthEl.change((e) => {
|
||||
const newValueStr = e.currentTarget.value;
|
||||
this.videoLength_ =
|
||||
newValueStr == 'infinite' ? Infinity : Number(newValueStr);
|
||||
this.videoLength_ = normalize(e.currentTarget.value);
|
||||
if (this.videoLengthHandler_) {
|
||||
this.videoLengthHandler_(this.videoLength_);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user