Skip to content

Commit

Permalink
Fix Edge Selection (#1146)
Browse files Browse the repository at this point in the history
* Fix update selection, add pointer cursor

* Update CHANGELOG.md
  • Loading branch information
elias-ba authored Sep 26, 2023
1 parent f2693b5 commit 1229177
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ and this project adheres to

### Fixed

- Fix highlighted Edge can get out of sync with selected Edge
[#1099](https://github.com/OpenFn/Lightning/issues/1099)

- Creating a new user without a password fails and there is no user feedback
[#731](https://github.com/OpenFn/Lightning/issues/731)

Expand Down
8 changes: 6 additions & 2 deletions assets/js/workflow-diagram/WorkflowDiagram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@ export default React.forwardRef<HTMLElement, WorkflowDiagramProps>(
const updateSelection = useCallback(
(id?: string) => {
if (id !== selection) {
chartCache.current.lastSelection = id;
onSelectionChange(id);
}
},
[onSelectionChange, selection]
);

const requestSelectionChange = useCallback((id?: string) => {
chartCache.current.lastSelection = id;
updateSelection(id);
}, []);

const { placeholders, add: addPlaceholder } = usePlaceholders(
ref,
store,
updateSelection
requestSelectionChange
);

const workflow = useStore(
Expand Down
2 changes: 1 addition & 1 deletion assets/js/workflow-diagram/edges/Edge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CustomEdge: FC<EdgeProps> = props => {
pointerEvents: 'all',
...labelStyles(selected),
}}
className="nodrag nopan"
className="nodrag nopan cursor-pointer"
>
{label}
</div>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/workflow-diagram/nodes/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const Node = ({

return (
<div className="group">
<div className="flex flex-row">
<div className="flex flex-row cursor-pointer">
<div>
{targetPosition && (
<Handle
Expand Down
3 changes: 0 additions & 3 deletions assets/js/workflow-diagram/usePlaceholders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ export default (
const updated = create(parentNode);
setPlaceholders(updated);

// clear the selection
// // TODO need to put the chart in placeholder mode
// chartCache.current.lastSelection = undefined;
requestSelectionChange(updated.nodes[0].id);
}, []);

Expand Down

0 comments on commit 1229177

Please sign in to comment.