Browse Source

Fix not showing loading indicator when searching in web UI (#17655)

closed-social-glitch-2
Eugen Rochko 2 years ago
committed by GitHub
parent
commit
cb2e198d89
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions
  1. +1
    -1
      app/javascript/mastodon/features/explore/results.js
  2. +4
    -2
      app/javascript/mastodon/reducers/search.js

+ 1
- 1
app/javascript/mastodon/features/explore/results.js View File

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

+ 4
- 2
app/javascript/mastodon/reducers/search.js View File

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

Loading…
Cancel
Save