[Glitch] Fix not showing loading indicator when searching in web UI

Port cb2e198d89 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
master
Eugen Rochko 2022-02-27 07:37:07 +01:00 committed by Claire
parent 058b74dc0a
commit 6e208a817d
2 changed files with 5 additions and 3 deletions

View File

@ -104,7 +104,7 @@ class Results extends React.PureComponent {
</div>
<div className='explore__search-results'>
{isLoading ? (<LoadingIndicator />) : filteredResults}
{isLoading ? <LoadingIndicator /> : filteredResults}
</div>
</React.Fragment>
);

View File

@ -41,7 +41,10 @@ export default function search(state = initialState, action) {
case COMPOSE_DIRECT:
return state.set('hidden', true);
case SEARCH_FETCH_REQUEST:
return state.set('isLoading', true);
return state.withMutations(map => {
map.set('isLoading', true);
map.set('submitted', true);
});
case SEARCH_FETCH_FAIL:
return state.set('isLoading', false);
case SEARCH_FETCH_SUCCESS:
@ -52,7 +55,6 @@ export default function search(state = initialState, action) {
hashtags: fromJS(action.results.hashtags),
}));
map.set('submitted', true);
map.set('searchTerm', action.searchTerm);
map.set('isLoading', false);
});