From f0b6340e4f3ff36d1068d506564bb68f5f17fa7d Mon Sep 17 00:00:00 2001
From: ArtemBaskal <a.baskal@adguard.com>
Date: Tue, 7 Apr 2020 17:21:44 +0300
Subject: [PATCH] - client: Clear result of checking the filtering result after
 moving to another page

---
 client/src/actions/filtering.js  | 8 +++++++-
 client/src/reducers/filtering.js | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/client/src/actions/filtering.js b/client/src/actions/filtering.js
index e3c2de11..4e44ce86 100644
--- a/client/src/actions/filtering.js
+++ b/client/src/actions/filtering.js
@@ -164,11 +164,17 @@ export const checkHostRequest = createAction('CHECK_HOST_REQUEST');
 export const checkHostFailure = createAction('CHECK_HOST_FAILURE');
 export const checkHostSuccess = createAction('CHECK_HOST_SUCCESS');
 
+/**
+ *
+ * @param {object} host
+ * @param {string} host.name
+ * @returns {undefined}
+ */
 export const checkHost = host => async (dispatch) => {
     dispatch(checkHostRequest());
     try {
         const data = await apiClient.checkHost(host);
-        const [hostname] = Object.values(host);
+        const { name: hostname } = host;
 
         dispatch(checkHostSuccess({
             hostname,
diff --git a/client/src/reducers/filtering.js b/client/src/reducers/filtering.js
index 3bc84b5b..544e0aad 100644
--- a/client/src/reducers/filtering.js
+++ b/client/src/reducers/filtering.js
@@ -13,7 +13,11 @@ const filtering = handleActions(
             return { ...state, userRules };
         },
 
-        [actions.getFilteringStatusRequest]: state => ({ ...state, processingFilters: true }),
+        [actions.getFilteringStatusRequest]: state => ({
+            ...state,
+            processingFilters: true,
+            check: {},
+        }),
         [actions.getFilteringStatusFailure]: state => ({ ...state, processingFilters: false }),
         [actions.getFilteringStatusSuccess]: (state, { payload }) => ({
             ...state,