mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
fix(pref): check for mounting on async launch service
This commit is contained in:
parent
00c1645300
commit
0d0cd0c58d
1 changed files with 14 additions and 4 deletions
|
@ -9,7 +9,13 @@ class DefaultMailClientItem extends React.Component
|
||||||
@_services = new LaunchServices()
|
@_services = new LaunchServices()
|
||||||
if @_services.available()
|
if @_services.available()
|
||||||
@_services.isRegisteredForURLScheme 'mailto', (registered) =>
|
@_services.isRegisteredForURLScheme 'mailto', (registered) =>
|
||||||
@setState(defaultClient: registered)
|
@setState(defaultClient: registered) if @_mounted
|
||||||
|
|
||||||
|
componentDidMount: ->
|
||||||
|
@_mounted = true
|
||||||
|
|
||||||
|
componentWillUnmount: ->
|
||||||
|
@_mounted = false
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
return false unless process.platform is 'darwin'
|
return false unless process.platform is 'darwin'
|
||||||
|
@ -36,11 +42,15 @@ class LaunchSystemStartItem extends React.Component
|
||||||
@_service = new SystemStartService()
|
@_service = new SystemStartService()
|
||||||
|
|
||||||
componentDidMount: ->
|
componentDidMount: ->
|
||||||
|
@_mounted = true
|
||||||
@_service.checkAvailability().then (available) =>
|
@_service.checkAvailability().then (available) =>
|
||||||
@setState {available}
|
@setState {available} if @_mounted
|
||||||
return if not available
|
return if not available or not @_mounted
|
||||||
@_service.doesLaunchOnSystemStart().then (launchOnStart) =>
|
@_service.doesLaunchOnSystemStart().then (launchOnStart) =>
|
||||||
@setState({launchOnStart})
|
@setState({launchOnStart}) if @_mounted
|
||||||
|
|
||||||
|
componentWillUnmount: ->
|
||||||
|
@_mounted = false
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
return false if not @state.available
|
return false if not @state.available
|
||||||
|
|
Loading…
Reference in a new issue