Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(RecommendationSystems): clear redux store on unmount #1193

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import React from 'react';
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { usePermissions } from '@redhat-cloud-services/frontend-components-utilities/RBACHook';
import Inventory from '../../../PresentationalComponents/Inventory/Inventory';
import { useSelector } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';
import { PERMS } from '../../../AppConstants';

const ConventionalSystems = ({ rule, afterDisableFn, handleModalToggle }) => {
const selectedTags = useSelector(({ filters }) => filters.selectedTags);
const workloads = useSelector(({ filters }) => filters.workloads);
const SID = useSelector(({ filters }) => filters.SID);
const permsExport = usePermissions('advisor', PERMS.export).hasAccess;
const dispatch = useDispatch();

Check warning on line 13 in src/SmartComponents/HybridInventoryTabs/ConventionalSystems/RecommendationSystems.js

View check run for this annotation

Codecov / codecov/patch

src/SmartComponents/HybridInventoryTabs/ConventionalSystems/RecommendationSystems.js#L13

Added line #L13 was not covered by tests

useEffect(() => {
return () => {
dispatch({

Check warning on line 17 in src/SmartComponents/HybridInventoryTabs/ConventionalSystems/RecommendationSystems.js

View check run for this annotation

Codecov / codecov/patch

src/SmartComponents/HybridInventoryTabs/ConventionalSystems/RecommendationSystems.js#L15-L17

Added lines #L15 - L17 were not covered by tests
type: 'CLEAR_INVENTORY_STORE',
payload: [],
});
};
}, [dispatch]);

const actionResolver = () => [
{
Expand Down