fix empty grid

This commit is contained in:
Gavin Nishizawa 2023-09-20 12:08:02 -07:00
parent 548af76b5e
commit 4ce32e7d05
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -64,11 +64,14 @@ func withoutGridDiagrams(ctx context.Context, g *d2graph.Graph, layout d2graph.L
var processGrid func(obj *d2graph.Object) error
processGrid = func(obj *d2graph.Object) error {
for _, child := range obj.ChildrenArray {
if len(child.ChildrenArray) == 0 {
continue
}
if child.IsGridDiagram() {
if err := processGrid(child); err != nil {
return err
}
} else if len(child.ChildrenArray) > 0 {
} else {
tempGraph := g.ExtractAsNestedGraph(child)
if err := layout(ctx, tempGraph); err != nil {
return err