mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-11 07:04:33 +08:00
fix(undo-redo): Clear timeout when component unmounts to avoid React errors
This commit is contained in:
parent
b3f7e40588
commit
99da4a112a
1 changed files with 4 additions and 3 deletions
|
@ -28,7 +28,7 @@ class UndoRedoComponent extends React.Component
|
||||||
clearTimeout(@_timeout)
|
clearTimeout(@_timeout)
|
||||||
|
|
||||||
_setNewTimeout: =>
|
_setNewTimeout: =>
|
||||||
clearTimeout(@_timeout)
|
@_clearTimeout()
|
||||||
@_timeout = setTimeout (=>
|
@_timeout = setTimeout (=>
|
||||||
@_hide()
|
@_hide()
|
||||||
return
|
return
|
||||||
|
@ -43,10 +43,11 @@ class UndoRedoComponent extends React.Component
|
||||||
return {show: s, task: t}
|
return {show: s, task: t}
|
||||||
|
|
||||||
componentWillMount: ->
|
componentWillMount: ->
|
||||||
@unsub = UndoRedoStore.listen(@_onChange)
|
@_unsubscribe = UndoRedoStore.listen(@_onChange)
|
||||||
|
|
||||||
componentWillUnmount: ->
|
componentWillUnmount: ->
|
||||||
@unsub()
|
@_clearTimeout()
|
||||||
|
@_unsubscribe()
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
items = [].concat(@_renderUndoRedoManager())
|
items = [].concat(@_renderUndoRedoManager())
|
||||||
|
|
Loading…
Add table
Reference in a new issue