commnts
This commit is contained in:
parent
e102fd98c3
commit
8a69f36972
1 changed files with 3 additions and 0 deletions
|
|
@ -643,7 +643,9 @@ func renameConflictsToParent(g *d2graph.Graph, key *d2ast.KeyPath) (*d2graph.Gra
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep a list of newly generated IDs, so that generateUniqueKey considers them for conflict
|
||||||
var newIDs []string
|
var newIDs []string
|
||||||
|
// If we already renamed the key from another reference, no need to touch
|
||||||
dedupedRenames := map[string]struct{}{}
|
dedupedRenames := map[string]struct{}{}
|
||||||
for _, ref := range obj.References {
|
for _, ref := range obj.References {
|
||||||
var absKeys []*d2ast.KeyPath
|
var absKeys []*d2ast.KeyPath
|
||||||
|
|
@ -694,6 +696,7 @@ func renameConflictsToParent(g *d2graph.Graph, key *d2ast.KeyPath) (*d2graph.Gra
|
||||||
if _, ok := dedupedRenames[absKeyStr]; ok {
|
if _, ok := dedupedRenames[absKeyStr]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Stale reference
|
||||||
dedupedRenames[absKeyStr] = struct{}{}
|
dedupedRenames[absKeyStr] = struct{}{}
|
||||||
// Do not consider the parent for conflicts, assume the parent will be deleted
|
// Do not consider the parent for conflicts, assume the parent will be deleted
|
||||||
if ida[len(ida)-1] == ida[len(ida)-2] {
|
if ida[len(ida)-1] == ida[len(ida)-2] {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue