From 32716cf0d3a7681a5a4620f2cc4e53fa5f8250f2 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Fri, 14 Oct 2022 23:14:22 +0900 Subject: [PATCH] [Glitch] Fix missing `isCancel` Port 14bae3580b0f89774535ad519c465f5ad75abba5 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/actions/compose.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 56a3b7b5ff..e68ba9c676 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -1,4 +1,4 @@ -import { isCancel } from 'axios'; +import axios from 'axios'; import { throttle } from 'lodash'; import { defineMessages } from 'react-intl'; import api from 'flavours/glitch/api'; @@ -501,9 +501,11 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => dispatch(importFetchedAccounts(response.data)); dispatch(readyComposeSuggestionsAccounts(token, response.data)); }).catch(error => { - if (!isCancel(error)) { + if (!axios.isCancel(error)) { dispatch(showAlertForError(error)); } + }).finally(() => { + fetchComposeSuggestionsAccountsController = undefined; }); }, 200, { leading: true, trailing: true }); @@ -533,9 +535,11 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => { }).then(({ data }) => { dispatch(readyComposeSuggestionsTags(token, data.hashtags)); }).catch(error => { - if (!isCancel(error)) { + if (!axios.isCancel(error)) { dispatch(showAlertForError(error)); } + }).finally(() => { + fetchComposeSuggestionsTagsController = undefined; }); }, 200, { leading: true, trailing: true });