-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: set $parent on create and set #50
base: main
Are you sure you want to change the base?
Conversation
Great initiative!
Not sure from this comment: Did you consider proxies? I'd love us to consider them, and discard if we found them unsuitable.
I think we cannot ship without that. If |
I wanted to start the conversation first. I was anticipating the question about proxies. I'm not to fond of them. I agree that it's not great to set the |
Usually we set to |
Now that I'm thinking about it, this could actually work. When calling |
7287a70
to
d46b55b
Compare
Done. |
@philippfromme Did you try this against diagram-js / bpmn-moddle / bpmn-js? Great code-bases to integration-test against. |
No I haven't done that yet. I can do that, though. I assume that introducing this feature would allow us to remove a lot of |
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.
Let's verify that it does not break anything in the downstream libraries.
That's what I'm doing. |
I will pick this up again once I have time. |
I converted the PR to draft for now so we don't get notification on Slack about it |
d46b55b
to
b0dded9
Compare
This pull request implements a simple approach to maintaining the
$parent
property.What it does ✅
Sets
$parent
when usingModdle#create
Sets
$parent
when usingBase#set
Unsets
$parent
when usingBase#set
What it doesn't do ⛔
Setting parent without using API
Unsetting parent without using API
This is the approach I'd prefer. Every model element has a clearly defined API. Using this API is the preferred way of working with model elements. Accessing properties without using the API (
parent.child = child;
) is possible but not necessarily intended. I consider setting and unsettling the parent using proxies as magic and, therefore, wouldn't implement that.Closes #41