Skip to content

Commit c274f93

Browse files
authored
feat: support factor in the UI (#1348)
Signed-off-by: Louis Mandel <[email protected]>
1 parent 6f66261 commit c274f93

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pdl-live-react/src/pdl_ast_utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ export function map_block_children(
217217
.with({ kind: "include" }, (block) => block)
218218
.with({ kind: "import" }, (block) => block)
219219
.with({ kind: "aggregator" }, (block) => block)
220+
.with({ kind: "factor" }, (block) => {
221+
const factor = f_expr(block.factor)
222+
return { ...block, factor }
223+
})
220224
.with({ kind: P.nullish }, (block) => block)
221225
// @ts-expect-error: TODO
222226
.exhaustive()
@@ -313,6 +317,9 @@ export function iter_block_children(
313317
.with({ kind: "include" }, () => {})
314318
.with({ kind: "import" }, () => {})
315319
.with({ kind: "aggregator" }, () => {})
320+
.with({ kind: "factor" }, (block) => {
321+
if (block.factor) f(block.factor)
322+
})
316323
.with({ kind: undefined }, () => {})
317324
// @ts-expect-error: TODO
318325
.exhaustive()

pdl-live-react/src/view/timeline/model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export function childrenOf(block: NonScalarPdlBlock) {
152152
.with({ kind: "empty" }, (data) =>
153153
data.defs ? Object.values(data.defs) : [],
154154
)
155+
.with({ kind: "factor" }, () => [])
155156
.with({ kind: "error" }, () => []) // TODO show errors in trace
156157
.with({ kind: P.nullish }, () => [])
157158
// @ts-expect-error: TODO

0 commit comments

Comments
 (0)