Fix missing `isCancel` (#19354)

pull/19356/head
Yamagishi Kazutoshi 2022-10-14 23:14:22 +09:00 committed by GitHub
parent 219c38b921
commit e02bdc14fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { isCancel } from 'axios'; import axios from 'axios';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import api from 'mastodon/api'; import api from 'mastodon/api';
@ -462,9 +462,11 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
dispatch(importFetchedAccounts(response.data)); dispatch(importFetchedAccounts(response.data));
dispatch(readyComposeSuggestionsAccounts(token, response.data)); dispatch(readyComposeSuggestionsAccounts(token, response.data));
}).catch(error => { }).catch(error => {
if (!isCancel(error)) { if (!axios.isCancel(error)) {
dispatch(showAlertForError(error)); dispatch(showAlertForError(error));
} }
}).finally(() => {
fetchComposeSuggestionsAccountsController = undefined;
}); });
}, 200, { leading: true, trailing: true }); }, 200, { leading: true, trailing: true });
@ -495,9 +497,11 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
}).then(({ data }) => { }).then(({ data }) => {
dispatch(readyComposeSuggestionsTags(token, data.hashtags)); dispatch(readyComposeSuggestionsTags(token, data.hashtags));
}).catch(error => { }).catch(error => {
if (!isCancel(error)) { if (!axios.isCancel(error)) {
dispatch(showAlertForError(error)); dispatch(showAlertForError(error));
} }
}).finally(() => {
fetchComposeSuggestionsTagsController = undefined;
}); });
}, 200, { leading: true, trailing: true }); }, 200, { leading: true, trailing: true });