Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): allow adding edges with missing source or target nodes #1149

Merged
merged 6 commits into from
Oct 27, 2023

Conversation

bcakmakoglu
Copy link
Owner

No description provided.

@bcakmakoglu bcakmakoglu added the refactor Refactor existing features label Oct 27, 2023
@bcakmakoglu bcakmakoglu self-assigned this Oct 27, 2023
@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2023

🦋 Changeset detected

Latest commit: 83ff958

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

This PR includes changesets to release 1 package
Name Type
@vue-flow/core Minor

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

@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vue-flow-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 5:45pm
vue-flow-typedoc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 5:45pm

@vercel vercel bot temporarily deployed to Preview – vue-flow-typedoc October 27, 2023 17:45 Inactive
@bcakmakoglu bcakmakoglu merged commit a7fe412 into release/1.24.0 Oct 27, 2023
5 checks passed
@bcakmakoglu bcakmakoglu deleted the refactor/add-edges branch October 27, 2023 17:49
@github-actions github-actions bot mentioned this pull request Oct 27, 2023
@snoozbuster
Copy link
Contributor

is there a way to opt-out of this behavior? I don't know why this would be useful, and in my application, it prevents the app from automatically recovering from an error. Of course, I'm working on fixing the bug that I introduced that causes edges with a missing source/target to be added in the first place - but the bug would have caused a much smaller problem with the pre-1.24.0 behavior of refusing to add the edge. I would much rather globally turn on the behavior from before this fix in my app.

@bcakmakoglu
Copy link
Owner Author

The behavior has been changed to match the behavior of ReactFlow as I don't want it to drift apart too much.
In RF you can add an "invalid" edge, it just won't be rendered.
It's still in your edges array and will just stay in there until it becomes valid (missing source/target node is added).
You can listen to these errors with the onError event though and just filter the edges out yourself if that's necessary but the previous behavior would've just removed elements from your state without you really knowing about it and when saved again those elements would be gone, which I don't want to decide for you.

@snoozbuster
Copy link
Contributor

Makes sense, I suppose. In my application nodes are only allowed to have one outgoing edge from each handle, and we disable that handle if there is an outgoing edge, so the behavior the user gets now if there's a bug that causes an invalid edge to be added is that the handle just seems broken and a new/replacement connection can't be made. But I see your point - I guess I can re-add this error handling myself if I want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants