diff --git a/d2layouts/d2layouts.go b/d2layouts/d2layouts.go index 6b2d1fc7a..8385d83db 100644 --- a/d2layouts/d2layouts.go +++ b/d2layouts/d2layouts.go @@ -67,8 +67,12 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co for _, e := range nestedGraph.Edges { e.Move(dx, dy) } - } else if !gi.isDefault() { + // empty grid can have 0 objects.. + if gi.DiagramType == GridDiagram && !gi.IsConstantNear && len(curr.Children) == 0 { + continue + } + extractedInfo[curr] = gi // There is a nested diagram here, so extract its contents and process in the same way