From 474306d46546097700d5c767c7283f33f63f53d7 Mon Sep 17 00:00:00 2001 From: ArtemBaskal Date: Thu, 3 Sep 2020 23:05:11 +0300 Subject: [PATCH] - client: Fix delay of custom filter editor --- client/src/actions/index.js | 4 ++-- client/src/components/Logs/Cells/ClientCell.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index ff512883..6842accc 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -561,10 +561,10 @@ export const toggleBlocking = (type, domain) => async (dispatch, getState) => { const matchPreparedUnblockingRule = userRules.match(preparedUnblockingRule); if (matchPreparedBlockingRule) { - dispatch(setRules(userRules.replace(`${blockingRule}`, ''))); + await dispatch(setRules(userRules.replace(`${blockingRule}`, ''))); dispatch(addSuccessToast(i18next.t('rule_removed_from_custom_filtering_toast', { rule: blockingRule }))); } else if (!matchPreparedUnblockingRule) { - dispatch(setRules(`${userRules}${lineEnding}${unblockingRule}\n`)); + await dispatch(setRules(`${userRules}${lineEnding}${unblockingRule}\n`)); dispatch(addSuccessToast(i18next.t('rule_added_to_custom_filtering_toast', { rule: unblockingRule }))); } else if (matchPreparedUnblockingRule) { dispatch(addSuccessToast(i18next.t('rule_added_to_custom_filtering_toast', { rule: unblockingRule }))); diff --git a/client/src/components/Logs/Cells/ClientCell.js b/client/src/components/Logs/Cells/ClientCell.js index 93830faa..da0c9c9b 100644 --- a/client/src/components/Logs/Cells/ClientCell.js +++ b/client/src/components/Logs/Cells/ClientCell.js @@ -59,7 +59,9 @@ const ClientCell = ({ 'btn-outline-danger': !isFiltered, }); - const onClick = () => dispatch(toggleBlocking(buttonType, domain)); + const onClick = async () => { + await dispatch(toggleBlocking(buttonType, domain)); + }; return