Skip to content

Commit

Permalink
prevent page reload on form submission
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huong Nguyen committed Oct 29, 2024
1 parent 8ef75b8 commit 0abbf59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/node-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const NodeListProvider = ({

const groups = getGroups({ items });

const onItemClick = (item) => {
const onItemClick = (event, item) => {
if (isGroupType(item.type)) {
onGroupItemChange(item, item.checked);
} else if (isModularPipelineType(item.type)) {
Expand All @@ -123,6 +123,9 @@ const NodeListProvider = ({
}
}
}

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

// To get existing values from URL query parameters
Expand Down
2 changes: 1 addition & 1 deletion src/components/node-list/node-list-tree-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const NodeListTreeItem = ({
onChange={(e) =>
onItemChange(data, !e.target.checked, e.target.dataset.iconType)
}
onClick={() => onItemClick(data)}
onClick={(e) => onItemClick(e, data)}
onMouseEnter={() => onItemMouseEnter(data)}
onMouseLeave={() => onItemMouseLeave(data)}
onToggleHoveredFocusMode={onToggleHoveredFocusMode}
Expand Down

0 comments on commit 0abbf59

Please sign in to comment.