Skip to content

fix: harden edge geometry and dynamic group behavior - #2416

Merged
Zsynuting merged 3 commits into
masterfrom
codex/fix-edge-and-group-regressions
Jul 21, 2026
Merged

fix: harden edge geometry and dynamic group behavior#2416
Zsynuting merged 3 commits into
masterfrom
codex/fix-edge-and-group-regressions

Conversation

@Zsynuting

@Zsynuting Zsynuting commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Prevent rounded-rectangle edge dragging from accepting impossible arc intersections or propagating non-finite endpoints.
  • Align DynamicGroup addElements paste translation with caller-managed offsets and add focused regression scenarios.
  • Make getCurvedEdgePath safely handle empty, single-point, and malformed point lists without changing the surrounding edge View behavior.
  • Add focused tests, runnable regression examples, and patch changesets for Core and Extension.

Motivation and Context

Degenerate edge geometry could produce NaN coordinates or throw while rendering a curved edge, which could interrupt graph interaction. DynamicGroup selection paste could also apply an unexpected default translation. These changes keep geometry finite, preserve the renderer boundary for malformed curved paths, and make paste positioning explicit.

UI verification is available in:

  • examples/feature-examples: rounded rectangle NaN reproducer.
  • examples/dynamic-group-regression: selection copy and paste scenarios.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that add or update documentation)
  • Chore (changes that do not modify src or test files)

Verification

  • pnpm test -- packages/core/__tests__/model/polyline-edge.test.ts packages/core/__tests__/util/node.test.ts packages/extension/__test__/dynamic-group packages/extension/__test__/materials/curved-edge/curved-edge.test.ts --runInBand — 11 suites and 79 tests passed.
  • pnpm --filter @logicflow/core build — passed.
  • pnpm --filter @logicflow/extension build — passed when run after the Core build.
  • pnpm --dir examples/feature-examples build — passed.
  • pnpm --dir examples/dynamic-group-regression build — still fails at the pre-existing src/scenarios/index.ts:631 model assertion; this is unrelated to the changed scenarios.
  • pnpm exec changeset status — passed.

Self Check before Merge

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copilot AI review requested due to automatic review settings July 21, 2026 09:15
@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2bfd527

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@logicflow/extension Patch
@logicflow/core Patch
dynamic-group-regression Patch
logicflow-docs Patch
@logicflow/layout Patch
@logicflow/react-node-registry Patch
@logicflow/vue-node-registry Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens edge-geometry handling in Core and improves Extension behaviors around curved-edge path generation and DynamicGroup copy/paste, adding targeted tests and runnable regression examples to prevent NaN/throw scenarios from interrupting interaction.

Changes:

  • Core: prevent non-finite polyline endpoints when dragging across rounded-rectangle straight-side regions; add regression tests.
  • Extension: make getCurvedEdgePath return safely for empty/single/malformed point lists; add tests.
  • Extension/examples: add dynamic-group selection copy/paste regression scenario and a feature-example reproducer for the rounded-rect NaN case; add patch changesets.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/extension/src/materials/curved-edge/index.ts Adds defensive validation and safe early-returns in getCurvedEdgePath.
packages/extension/src/dynamic-group/index.ts Changes DynamicGroup’s addElements default distance behavior.
packages/extension/test/materials/curved-edge/curved-edge.test.ts Adds regression coverage for empty/single/malformed curved-edge point lists.
packages/core/src/util/node.ts Ensures rounded-rect intersection selection falls back to straight-side crosspoints when arcs can’t intersect.
packages/core/src/model/edge/PolylineEdgeModel.ts Guards against replacing endpoints with non-finite intersection results.
packages/core/tests/util/node.test.ts Adds tests for rounded-rectangle straight-side vs corner intersection behavior.
packages/core/tests/model/polyline-edge.test.ts Adds a regression test preventing NaN endpoints during rounded-rect dragging.
examples/feature-examples/src/pages/edges/custom/rounded-rect-nan/index.tsx Adds a UI reproducer page for the rounded-rect NaN drag issue.
examples/feature-examples/src/pages/edges/custom/rounded-rect-nan/index.less Styles for the reproducer page overlays and data panel.
examples/feature-examples/.umirc.ts Registers the new rounded-rect NaN regression route.
examples/dynamic-group-regression/src/scenarios/selectionCopyPaste.ts Adds a focused selection copy/paste regression scenario and diagnostics.
examples/dynamic-group-regression/src/scenarios/index.ts Wires the new selection copy/paste scenario into the workbench.
examples/dynamic-group-regression/src/components/SelectionCopyControls.tsx Adds scenario controls for selection, copy, paste, diagnose, and move-to-repro separation.
examples/dynamic-group-regression/src/components/RegressionWorkbench.tsx Enables SelectionSelect plugin to support box-selection in the new scenario.
examples/dynamic-group-regression/README.md Documents the new regression scenario and how to reproduce it.
.changeset/fix-rounded-rect-edge-nan.md Adds a Core patch changeset for finite polyline endpoints during rounded-rect dragging.
.changeset/fix-invalid-polyline-path-rendering.md Adds an Extension patch changeset for safe curved-edge path generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 903 to 906
lf.addElements = (
{ nodes: selectedNodes, edges: selectedEdges }: GraphConfigData,
distance = 40,
distance = 0,
): GraphElements => {
@Zsynuting
Zsynuting merged commit 419d976 into master Jul 21, 2026
1 check passed
@Zsynuting
Zsynuting deleted the codex/fix-edge-and-group-regressions branch July 21, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants