fix(search): Allow typing in the middle of the search text

This commit is contained in:
Ben Gotow 2015-11-04 17:11:40 -08:00
parent f59de7262d
commit dc538930a7
2 changed files with 7 additions and 9 deletions

View file

@ -105,10 +105,11 @@ class SearchBar extends React.Component
str += val
else
str += val
str
_stringToQuery: (str) =>
return [] unless str
return [all: str]
return [{all: str}]
_onValueChange: (event) =>
Actions.searchQueryChanged(@_stringToQuery(event.target.value))

View file

@ -24,29 +24,26 @@ SearchSuggestionStore = Reflux.createStore
onSearchQueryChanged: (query) ->
@_query = query
@_rebuildResults()
@trigger()
_.defer => @_rebuildResults()
onSearchQueryCommitted: (query) ->
@_query = query
@_committedQuery = query
@_clearResults()
@trigger()
onSearchBlurred: ->
@_clearResults()
@trigger()
_clearResults: ->
@_threadResults = null
@_contactResults = null
@_suggestions = []
@trigger()
_rebuildResults: ->
{key, val} = @queryKeyAndVal()
unless key and val
@_clearResults()
@trigger(@)
return
return @_clearResults() unless key and val
ContactStore.searchContacts(val, limit:10).then (results) =>
@_contactResults = results
@ -98,7 +95,7 @@ SearchSuggestionStore = Reflux.createStore
contact: contact
value: [{"all": contact.email}]
@trigger(@)
@trigger()
# Exposed Data