зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1518613 - [release 118] cleanup search state after project search (#7676). r=dwalsh
This commit is contained in:
Родитель
0652d24844
Коммит
2cfd139639
|
@ -38,7 +38,7 @@ export const statusType = {
|
|||
export type ResultList = Search[];
|
||||
export type ProjectTextSearchState = {
|
||||
+query: string,
|
||||
+ongoingSearch?: SearchOperation,
|
||||
+ongoingSearch: ?SearchOperation,
|
||||
+results: ResultList,
|
||||
+status: string
|
||||
};
|
||||
|
@ -47,6 +47,7 @@ export function initialProjectTextSearchState(): ProjectTextSearchState {
|
|||
return {
|
||||
query: "",
|
||||
results: [],
|
||||
ongoingSearch: null,
|
||||
status: statusType.initial
|
||||
};
|
||||
}
|
||||
|
@ -80,7 +81,9 @@ function update(
|
|||
return { ...state, results: [...results, result] };
|
||||
|
||||
case "UPDATE_STATUS":
|
||||
return { ...state, status: action.status };
|
||||
const ongoingSearch =
|
||||
action.status == statusType.fetching ? state.ongoingSearch : null;
|
||||
return { ...state, status: action.status, ongoingSearch };
|
||||
|
||||
case "CLEAR_SEARCH_RESULTS":
|
||||
return { ...state, results: [] };
|
||||
|
|
Загрузка…
Ссылка в новой задаче