mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +08:00
fix(important): Resilient against invalid AccountStore state (Sentry 4049)
This commit is contained in:
parent
8b8c333ad8
commit
c914b2701b
1 changed files with 4 additions and 4 deletions
|
@ -13,14 +13,14 @@ class MailImportantIcon extends React.Component
|
||||||
thread: React.PropTypes.object
|
thread: React.PropTypes.object
|
||||||
|
|
||||||
constructor: (@props) ->
|
constructor: (@props) ->
|
||||||
@state = @getStateFromStores()
|
@state = @getState()
|
||||||
|
|
||||||
getStateFromStores: =>
|
getState: =>
|
||||||
showing: AccountStore.current().usesImportantFlag() and atom.config.get('core.showImportant')
|
showing: AccountStore.current()?.usesImportantFlag() and atom.config.get('core.showImportant')
|
||||||
|
|
||||||
componentDidMount: =>
|
componentDidMount: =>
|
||||||
@subscription = atom.config.observe 'core.showImportant', =>
|
@subscription = atom.config.observe 'core.showImportant', =>
|
||||||
@setState(@getStateFromStores())
|
@setState(@getState())
|
||||||
|
|
||||||
componentWillUnmount: =>
|
componentWillUnmount: =>
|
||||||
@subscription?.dispose()
|
@subscription?.dispose()
|
||||||
|
|
Loading…
Reference in a new issue