diff options
-rw-r--r-- | ui/lib/persistent-form.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/lib/persistent-form.js b/ui/lib/persistent-form.js index 2fd7600a2..c2bf99360 100644 --- a/ui/lib/persistent-form.js +++ b/ui/lib/persistent-form.js @@ -14,6 +14,9 @@ inherits(PersistentForm, Component) PersistentForm.prototype.componentDidMount = function () { const fields = document.querySelectorAll('[data-persistent-formid]') const store = this.getPersistentStore() + if (!fields) { + return + } fields.forEach((field) => { const key = field.getAttribute('data-persistent-formid') const cached = store[key] @@ -50,8 +53,12 @@ PersistentForm.prototype.persistentFieldDidUpdate = function (event) { PersistentForm.prototype.componentWillUnmount = function () { const fields = document.querySelectorAll('[data-persistent-formid]') + if (!fields) { + return + } fields.forEach((field) => { field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this)) }) this.setPersistentStore({}) } + |