Skip to content

Commit

Permalink
fix the filters URL update
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huong Nguyen committed Nov 12, 2024
1 parent 3b3b2f2 commit cc11759
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/nodes-panel/utils/filters-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getFocusedModularPipeline } from '../../../selectors/modular-pipelines'

import { toggleTagFilter } from '../../../actions/tags';
import { toggleTypeDisabled } from '../../../actions/node-type';
import { loadNodeData, toggleNodeHovered } from '../../../actions/nodes';

import { params, localStorageName, NODE_TYPES } from '../../../config';
import {
Expand Down Expand Up @@ -48,6 +49,14 @@ const useFiltersContextSelector = () => {
dispatch(toggleTagFilter(tagIDs, enabled));
};

const onToggleNodeSelected = (nodeID) => {
dispatch(loadNodeData(nodeID));
};

const onToggleNodeHovered = (nodeID) => {
dispatch(toggleNodeHovered(nodeID));
};

return {
tags,
nodes,
Expand All @@ -58,6 +67,8 @@ const useFiltersContextSelector = () => {
inputOutputDataNodes,
onToggleTypeDisabled,
onToggleTagFilter,
onToggleNodeSelected,
onToggleNodeHovered,
};
};

Expand All @@ -75,6 +86,8 @@ export const FiltersContextProvider = ({ children }) => {
inputOutputDataNodes,
onToggleTypeDisabled,
onToggleTagFilter,
onToggleNodeSelected,
onToggleNodeHovered,
} = useFiltersContextSelector();

const [groupCollapsed, setGroupCollapsed] = useState(
Expand Down Expand Up @@ -207,12 +220,13 @@ export const FiltersContextProvider = ({ children }) => {
}

// Reset node selection
// onToggleNodeSelected(null);
// onToggleNodeActive(null);
onToggleNodeSelected(null);
onToggleNodeHovered(null);
};

const handleFiltersRowClicked = (event, item) => {
onGroupItemChange(item, item.checked);
handleUrlParamsUpdateOnFilter(item);

// to prevent page reload on form submission
event.preventDefault();
Expand Down

0 comments on commit cc11759

Please sign in to comment.