mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Add tolerance for failed form persisting
This commit is contained in:
parent
e85418b11a
commit
fb6476224f
@ -14,6 +14,9 @@ inherits(PersistentForm, Component)
|
|||||||
PersistentForm.prototype.componentDidMount = function () {
|
PersistentForm.prototype.componentDidMount = function () {
|
||||||
const fields = document.querySelectorAll('[data-persistent-formid]')
|
const fields = document.querySelectorAll('[data-persistent-formid]')
|
||||||
const store = this.getPersistentStore()
|
const store = this.getPersistentStore()
|
||||||
|
if (!fields) {
|
||||||
|
return
|
||||||
|
}
|
||||||
fields.forEach((field) => {
|
fields.forEach((field) => {
|
||||||
const key = field.getAttribute('data-persistent-formid')
|
const key = field.getAttribute('data-persistent-formid')
|
||||||
const cached = store[key]
|
const cached = store[key]
|
||||||
@ -50,8 +53,12 @@ PersistentForm.prototype.persistentFieldDidUpdate = function (event) {
|
|||||||
|
|
||||||
PersistentForm.prototype.componentWillUnmount = function () {
|
PersistentForm.prototype.componentWillUnmount = function () {
|
||||||
const fields = document.querySelectorAll('[data-persistent-formid]')
|
const fields = document.querySelectorAll('[data-persistent-formid]')
|
||||||
|
if (!fields) {
|
||||||
|
return
|
||||||
|
}
|
||||||
fields.forEach((field) => {
|
fields.forEach((field) => {
|
||||||
field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
||||||
})
|
})
|
||||||
this.setPersistentStore({})
|
this.setPersistentStore({})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user