mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-21 22:54:11 +08:00
fix(search): reset on thread change
This commit is contained in:
parent
26888f9287
commit
339091b346
1 changed files with 10 additions and 0 deletions
|
@ -3,6 +3,7 @@ import DOMUtils from '../../dom-utils'
|
||||||
import NylasStore from 'nylas-store'
|
import NylasStore from 'nylas-store'
|
||||||
import Actions from '../actions'
|
import Actions from '../actions'
|
||||||
import {MAX_MATCHES, CHAR_THRESHOLD} from '../../searchable-components/search-constants'
|
import {MAX_MATCHES, CHAR_THRESHOLD} from '../../searchable-components/search-constants'
|
||||||
|
import FocusedContentStore from './focused-content-store'
|
||||||
|
|
||||||
class SearchableComponentStore extends NylasStore {
|
class SearchableComponentStore extends NylasStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -19,9 +20,18 @@ class SearchableComponentStore extends NylasStore {
|
||||||
|
|
||||||
this.searchRegions = {}
|
this.searchRegions = {}
|
||||||
|
|
||||||
|
this._lastThread = FocusedContentStore.focused('thread')
|
||||||
|
|
||||||
this.listenTo(Actions.findInThread, this._findInThread)
|
this.listenTo(Actions.findInThread, this._findInThread)
|
||||||
this.listenTo(Actions.nextSearchResult, this._nextSearchResult)
|
this.listenTo(Actions.nextSearchResult, this._nextSearchResult)
|
||||||
this.listenTo(Actions.previousSearchResult, this._previousSearchResult)
|
this.listenTo(Actions.previousSearchResult, this._previousSearchResult)
|
||||||
|
this.listenTo(FocusedContentStore, () => {
|
||||||
|
const newThread = FocusedContentStore.focused('thread')
|
||||||
|
if (newThread !== this._lastThread) {
|
||||||
|
this._findInThread(null);
|
||||||
|
this._lastThread = newThread
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentRegionIndex(regionId) {
|
getCurrentRegionIndex(regionId) {
|
||||||
|
|
Loading…
Reference in a new issue