Skip to content

Commit 3bbb338

Browse files
committed
fix edge suspension
1 parent 0135cd1 commit 3bbb338

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

d2ir/compile.go

+22-4
Original file line numberDiff line numberDiff line change
@@ -1275,10 +1275,28 @@ func (c *compiler) _compileEdges(refctx *RefContext) {
12751275

12761276
if refctx.Key.Primary.Suspension != nil || refctx.Key.Value.Suspension != nil {
12771277
if !c.lazyGlobBeingApplied {
1278+
var suspensionValue bool
12781279
if refctx.Key.Primary.Suspension != nil {
1279-
e.suspended = refctx.Key.Primary.Suspension.Value
1280+
suspensionValue = refctx.Key.Primary.Suspension.Value
12801281
} else {
1281-
e.suspended = refctx.Key.Value.Suspension.Value
1282+
suspensionValue = refctx.Key.Value.Suspension.Value
1283+
}
1284+
e.suspended = suspensionValue
1285+
1286+
// If we're unsuspending an edge, we should also unsuspend its src and dst objects
1287+
if !suspensionValue {
1288+
// Find the source and destination objects
1289+
srcPath, dstPath := e.ID.SrcPath, e.ID.DstPath
1290+
srcObj := refctx.ScopeMap.GetField(srcPath...)
1291+
dstObj := refctx.ScopeMap.GetField(dstPath...)
1292+
1293+
// Unsuspend the objects
1294+
if srcObj != nil {
1295+
srcObj.suspended = false
1296+
}
1297+
if dstObj != nil {
1298+
dstObj.suspended = false
1299+
}
12821300
}
12831301
}
12841302
}
@@ -1309,7 +1327,7 @@ func (c *compiler) _compileEdges(refctx *RefContext) {
13091327
}
13101328
c.compileField(e.Map_, refctx.Key.EdgeKey, refctx)
13111329
} else {
1312-
if refctx.Key.Primary.Unbox() != nil {
1330+
if refctx.Key.Primary.Unbox() != nil && refctx.Key.Primary.Suspension == nil {
13131331
if c.ignoreLazyGlob(e) {
13141332
return
13151333
}
@@ -1330,7 +1348,7 @@ func (c *compiler) _compileEdges(refctx *RefContext) {
13301348
c.mapRefContextStack = append(c.mapRefContextStack, refctx)
13311349
c.compileMap(e.Map_, refctx.Key.Value.Map, refctx.ScopeAST)
13321350
c.mapRefContextStack = c.mapRefContextStack[:len(c.mapRefContextStack)-1]
1333-
} else if refctx.Key.Value.ScalarBox().Unbox() != nil {
1351+
} else if refctx.Key.Value.ScalarBox().Unbox() != nil && refctx.Key.Value.Suspension == nil {
13341352
if c.ignoreLazyGlob(e) {
13351353
return
13361354
}

0 commit comments

Comments
 (0)