ngneat / dag

🐠 An Angular service for managing directed acyclic graphs
MIT License
155 stars 7 forks source link

duplicate steps on the same level #33

Closed shyallegro closed 1 year ago

shyallegro commented 2 years ago

I'm submitting a bug


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

given a graph with 2 levels, parent level with 3 nodes, child level with 3 nodes, each pointing to all 3 parents, will duplicate the children level nodes 3 times, producing 9 steps instead of 3.

Expected behavior

only 3 nodes in child level

Minimal reproduction of the problem with instructions


[
  {
    "stepId": 1,
    "parentIds": [0]
  },
  {
    "stepId": 2,
    "parentIds": [0]
  },
  {
    "stepId": 3,
    "parentIds": [0]
  },
  {
    "stepId": 4,
    "parentIds": [0, 2, 3, 1]
  },
  {
    "stepId": 5,
    "parentIds": [0, 2, 3, 1]
  },
  {
    "stepId": 6,
    "parentIds": [0,  2, 3, 1]
  },
  {
    "stepId": 7,
    "parentIds": [0, 6, 5, 4]
  }
]

Environment


Angular version: 13

Browser:
- [X] Chrome (desktop) version latest
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [X] Firefox version 101
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: 16.14.2
- Platform:   Windows

pjlamb12 commented 1 year ago

Hi, I'm sorry I've been bad at looking at issues. Can you create a Stackblitz showing this issue? Then I can hopefully play with it and figure it out.

shyallegro commented 1 year ago

@pjlamb12 thanks for the reply here is a demo https://angular-ivy-xvqdp2.stackblitz.io

pjlamb12 commented 1 year ago

@shyallegro I looked at this, and while I guess it's technically a bug, it also is an invalid model. The children (steps 4, 5, and 6) shouldn't point at 1, 2, 3 and 0. If you remove the 0, then it displays as it should.