diff --git a/src/modules/chats.js b/src/modules/chats.js index 60273a44..8e2fabb6 100644 --- a/src/modules/chats.js +++ b/src/modules/chats.js @@ -112,14 +112,14 @@ const chats = { setChatListFetcher (state, { commit, fetcher }) { const prevFetcher = state.chatListFetcher if (prevFetcher) { - prevFetcher() + prevFetcher.stop() } state.chatListFetcher = fetcher && fetcher() }, setCurrentChatFetcher (state, { fetcher }) { const prevFetcher = state.fetcher if (prevFetcher) { - prevFetcher() + prevFetcher.stop() } state.fetcher = fetcher && fetcher() }, diff --git a/src/services/promise_interval/promise_interval.js b/src/services/promise_interval/promise_interval.js index ee46a236..cf17970d 100644 --- a/src/services/promise_interval/promise_interval.js +++ b/src/services/promise_interval/promise_interval.js @@ -8,9 +8,8 @@ export const promiseInterval = (promiseCall, interval) => { let stopped = false let timeout = null - let func = () => {} - func = () => { + const func = () => { promiseCall().finally(() => { if (stopped) return timeout = window.setTimeout(func, interval)