From fb6476224ff0537e179705c2ae0895672a23a67b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 29 Aug 2016 16:40:57 -0700 Subject: Add tolerance for failed form persisting --- ui/lib/persistent-form.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ui') 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({}) } + -- cgit v1.2.3