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 () {
|
||||
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({})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user