-
Notifications
You must be signed in to change notification settings - Fork 76
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
fix: Check for circular references #13783
Conversation
15c547a
to
4666c82
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13783 +/- ##
==========================================
+ Coverage 95.16% 95.18% +0.01%
==========================================
Files 1690 1691 +1
Lines 22354 22438 +84
Branches 2622 2630 +8
==========================================
+ Hits 21273 21357 +84
Misses 835 835
Partials 246 246 ☔ View full report in Codecov by Sentry. |
4666c82
to
45aefdf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Impressive work 💎
# Conflicts: # frontend/packages/schema-model/src/lib/SchemaModel/SchemaModel.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🥳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work 🚀 it works as expected 😄
Description
Added an alert that pops up when an operation (either moving a node or adding a reference) would lead to a state with circular references, which we currently don't support.
This is done using a new method on the
SchemaModel
class, which I namedwillResultInCircularReferences
. It takes the potential child node pointer and the target pointer as parameters and returnstrue
when the target pointer is within a definition that is already referred by the potential child or one of its subnodes.Demos
Adding references
In the following examples,
type1
can't be dragged intotype2
sincetype1
contains a reference totype2
.https://github.com/user-attachments/assets/91cd845d-8aee-45d3-af7e-372cac02d76b
https://github.com/user-attachments/assets/c3ca19f1-b805-4ab1-ae8d-e17a310b22f8
Moving references
In this example, a reference to
type2
is being dragged into another reference totype2
.https://github.com/user-attachments/assets/2d1c4246-a043-4dbe-b6df-4e610640f2fa
Related Issue(s)
Verification