mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 07:36:12 +08:00
fix(packages): Wait for package-store to be used before using APM to load the packages
This commit is contained in:
parent
5ea02ead4f
commit
aba6cf80be
1 changed files with 12 additions and 5 deletions
|
@ -65,21 +65,19 @@ SettingsPackagesStore = Reflux.createStore
|
||||||
unless atom.packages.isPackageDisabled(pkg.name)
|
unless atom.packages.isPackageDisabled(pkg.name)
|
||||||
atom.packages.disablePackage(pkg.name)
|
atom.packages.disablePackage(pkg.name)
|
||||||
|
|
||||||
atom.packages.onDidActivatePackage(=> @_onPackagesChangedDebounced())
|
@_hasPrepared = false
|
||||||
atom.packages.onDidDeactivatePackage(=> @_onPackagesChangedDebounced())
|
|
||||||
atom.packages.onDidLoadPackage(=> @_onPackagesChangedDebounced())
|
|
||||||
atom.packages.onDidUnloadPackage(=> @_onPackagesChangedDebounced())
|
|
||||||
@_onPackagesChanged()
|
|
||||||
|
|
||||||
# Getters
|
# Getters
|
||||||
|
|
||||||
installed: ->
|
installed: ->
|
||||||
|
@_prepareIfFresh()
|
||||||
@_addPackageStates(@_filter(@_installed, @_installedSearch))
|
@_addPackageStates(@_filter(@_installed, @_installedSearch))
|
||||||
|
|
||||||
installedSearchValue: ->
|
installedSearchValue: ->
|
||||||
@_installedSearch
|
@_installedSearch
|
||||||
|
|
||||||
featured: ->
|
featured: ->
|
||||||
|
@_prepareIfFresh()
|
||||||
@_addPackageStates(@_featured)
|
@_addPackageStates(@_featured)
|
||||||
|
|
||||||
searchResults: ->
|
searchResults: ->
|
||||||
|
@ -90,6 +88,15 @@ SettingsPackagesStore = Reflux.createStore
|
||||||
|
|
||||||
# Action Handlers
|
# Action Handlers
|
||||||
|
|
||||||
|
_prepareIfFresh: ->
|
||||||
|
return if @_hasPrepared
|
||||||
|
atom.packages.onDidActivatePackage(=> @_onPackagesChangedDebounced())
|
||||||
|
atom.packages.onDidDeactivatePackage(=> @_onPackagesChangedDebounced())
|
||||||
|
atom.packages.onDidLoadPackage(=> @_onPackagesChangedDebounced())
|
||||||
|
atom.packages.onDidUnloadPackage(=> @_onPackagesChangedDebounced())
|
||||||
|
@_onPackagesChanged()
|
||||||
|
@_hasPrepared = true
|
||||||
|
|
||||||
_filter: (hash, search) ->
|
_filter: (hash, search) ->
|
||||||
result = {}
|
result = {}
|
||||||
search = search.toLowerCase()
|
search = search.toLowerCase()
|
||||||
|
|
Loading…
Reference in a new issue