From 57ca48ed6bc3adfdcafa74ca7631b9c04c7e24d1 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 26 Apr 2019 10:19:32 +0200 Subject: [PATCH] state widget: allow resetting value and prevent loading null --- src/client/app/widgets/switchers/state.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/app/widgets/switchers/state.js b/src/client/app/widgets/switchers/state.js index c0ead3c9..9eb25ce4 100644 --- a/src/client/app/widgets/switchers/state.js +++ b/src/client/app/widgets/switchers/state.js @@ -93,7 +93,7 @@ class State extends Widget { load(send) { - stateMananer.set(this.value, send) + if (this.value) stateMananer.set(this.value, send) } @@ -111,7 +111,12 @@ class State extends Widget { this.load(options.send) valid = true - } else if (typeof v === 'object' && v !== null && !Array.isArray(v)) { + } else if (v === null) { + + if (this.value) this.loadButton.container.classList.add('disabled') + this.value = null + + } else if (typeof v === 'object' && !Array.isArray(v)) { if (!this.value) this.loadButton.container.classList.remove('disabled') this.value = v