Skip to content

Passing edges when the type is custom#53

Merged
zachiler merged 3 commits into
devfrom
custom-edge-passing
Jul 21, 2026
Merged

Passing edges when the type is custom#53
zachiler merged 3 commits into
devfrom
custom-edge-passing

Conversation

@ronnorthrip

Copy link
Copy Markdown
Collaborator

Passing edges when the type is custom

@ronnorthrip
ronnorthrip requested a review from zachiler July 21, 2026 01:53
zachiler added 2 commits July 20, 2026 23:42
The custom-edge-passing PR carried a full dist/ rebuild. Per repo convention the committed bundle is regenerated at merge/resync, so revert dist to dev and keep the PR to its source change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_0162MtGveF5YPNaEitFaowKM
…alization

- Type the custom generator's sourcePosition/targetPosition as the 'top'|'right'|'bottom'|'left' cardinal union (matching getEdgePath's internal signature) instead of the looser `string`.

- Add a test proving per-edge route data on edge.data survives a JSON round-trip (as toObject()/fromObject() do) and drives the generated path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_0162MtGveF5YPNaEitFaowKM
@zachiler

Copy link
Copy Markdown
Member

Thanks for this, @ronnorthrip — this is a nice catch. You correctly identified that forcing per-edge routing through a closure meant it couldn't survive toObject()/fromObject(), and passing the edge to the generator is exactly the right fix. Clean, non-breaking, well-documented. 🙏

I've merged it with a few maintainer touch-ups on top of your commit:

  1. Dropped the dist/ bundle rebuild. Just a repo convention thing for next time — the committed dist/ bundle is a release artifact we regenerate at merge/resync, so feature branches should leave it untouched (it's easy to miss since it's normally gitignored). I reverted those two files to dev so the PR reads as its actual ~15-line source change.
  2. Tightened the edgeTypes param types. The public FlowCanvasConfig.edgeTypes typed sourcePosition/targetPosition as string; I narrowed them to the 'top' | 'right' | 'bottom' | 'left' cardinal union to match getEdgePath's internal signature, so consumers get proper narrowing.
  3. Added a serialization round-trip test. Since the headline benefit is "a custom-routed edge survives a reload," I added a test that stashes route data on edge.data, round-trips it through the same JSON serialization toObject()/fromObject() use, and asserts the generator still produces the routed path — locking in the exact behavior your change enables.

Full suite green (2919 tests) and typecheck clean. Appreciate the report and the fix!

@zachiler
zachiler merged commit 9f7c386 into dev Jul 21, 2026
@ronnorthrip
ronnorthrip deleted the custom-edge-passing branch July 21, 2026 17:12
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