mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-07 13:14:47 +08:00
fix(message-list-toolbar): Fix observable for selection & focused thread
This commit is contained in:
parent
9bbaf3b90d
commit
dfd051339d
2 changed files with 11 additions and 19 deletions
|
@ -8,23 +8,16 @@ import InjectsToolbarButtons, {ToolbarRole} from './injects-toolbar-buttons'
|
|||
|
||||
function getObservable() {
|
||||
return (
|
||||
Rx.Observable.merge(
|
||||
Rx.Observable.combineLatest(
|
||||
Rx.Observable.fromStore(FocusedContentStore),
|
||||
ThreadListStore.selectionObservable(),
|
||||
(store, items) => ({focusedThread: store.focused('thread'), items})
|
||||
)
|
||||
.map((data) => {
|
||||
const storeChanged = data === FocusedContentStore
|
||||
const selectionChanged = data instanceof Array
|
||||
|
||||
if (storeChanged) {
|
||||
const focusedThread = FocusedContentStore.focused('thread')
|
||||
if (focusedThread) {
|
||||
return [focusedThread]
|
||||
}
|
||||
} else if (selectionChanged) {
|
||||
return data
|
||||
.map(({focusedThread, items}) => {
|
||||
if (focusedThread) {
|
||||
return [focusedThread]
|
||||
}
|
||||
return []
|
||||
return items
|
||||
})
|
||||
)
|
||||
}
|
||||
|
|
|
@ -86,12 +86,11 @@ Rx.Observable.fromListSelection = (originStore) =>
|
|||
)
|
||||
return
|
||||
)
|
||||
return {
|
||||
dispose: =>
|
||||
if dataSourceDisposable
|
||||
dataSourceDisposable.dispose()
|
||||
disposable.dispose()
|
||||
}
|
||||
dispose = =>
|
||||
if dataSourceDisposable
|
||||
dataSourceDisposable.dispose()
|
||||
disposable.dispose()
|
||||
return Rx.Disposable.create(dispose)
|
||||
)
|
||||
|
||||
Rx.Observable.fromConfig = (configKey) =>
|
||||
|
|
Loading…
Add table
Reference in a new issue