Skip to content

Commit 0f4593b

Browse files
agoose77fwkoch
authored andcommitted
refactor: simplify conditions
We don't need to delete nodes without children: they will simply vanish when lifted
1 parent 906f93c commit 0f4593b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/myst-cli/src/transforms/outputs.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,12 @@ export function reduceOutputs(
262262
outputNode.type = '__delete__';
263263
return;
264264
}
265-
if (!outputNode.jupyter_data && !outputNode.children?.length) {
266-
outputNode.type = '__delete__';
267-
return;
268-
}
269265
// Lift the `output` node into `Outputs`
270266
outputNode.type = '__lift__';
271267

272268
// If the output already has children, we don't need to do anything
273-
if (outputNode.children?.length) {
269+
// Or, if it has no output data (should not happen)
270+
if (outputNode.children?.length || !outputNode.jupyter_data) {
274271
return;
275272
}
276273

0 commit comments

Comments
 (0)