mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-11-10 00:11:34 +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() {
|
function getObservable() {
|
||||||
return (
|
return (
|
||||||
Rx.Observable.merge(
|
Rx.Observable.combineLatest(
|
||||||
Rx.Observable.fromStore(FocusedContentStore),
|
Rx.Observable.fromStore(FocusedContentStore),
|
||||||
ThreadListStore.selectionObservable(),
|
ThreadListStore.selectionObservable(),
|
||||||
|
(store, items) => ({focusedThread: store.focused('thread'), items})
|
||||||
)
|
)
|
||||||
.map((data) => {
|
.map(({focusedThread, items}) => {
|
||||||
const storeChanged = data === FocusedContentStore
|
if (focusedThread) {
|
||||||
const selectionChanged = data instanceof Array
|
return [focusedThread]
|
||||||
|
|
||||||
if (storeChanged) {
|
|
||||||
const focusedThread = FocusedContentStore.focused('thread')
|
|
||||||
if (focusedThread) {
|
|
||||||
return [focusedThread]
|
|
||||||
}
|
|
||||||
} else if (selectionChanged) {
|
|
||||||
return data
|
|
||||||
}
|
}
|
||||||
return []
|
return items
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,11 @@ Rx.Observable.fromListSelection = (originStore) =>
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
)
|
)
|
||||||
return {
|
dispose = =>
|
||||||
dispose: =>
|
if dataSourceDisposable
|
||||||
if dataSourceDisposable
|
dataSourceDisposable.dispose()
|
||||||
dataSourceDisposable.dispose()
|
disposable.dispose()
|
||||||
disposable.dispose()
|
return Rx.Disposable.create(dispose)
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Rx.Observable.fromConfig = (configKey) =>
|
Rx.Observable.fromConfig = (configKey) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue