Skip to content

Commit

Permalink
Merge pull request #10 from JackDevine/main
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Oct 21, 2024
2 parents 1f9fd41 + 19b1a2c commit d1b8b26
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TopologyUpdate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ function updated_topology(
new_code_str = get_code_str(cell)

if old_code.code !== new_code_str
parsedcode = get_code_expr(cell)
parsedcode = let x = get_code_expr(cell)
x isa Expr ? x : Expr(:block, x)
end
new_code = updated_codes[cell] = ExprAnalysisCache(new_code_str, parsedcode)
new_reactive_node = ExpressionExplorer.compute_reactive_node(ExpressionExplorerExtras.pretransform_pluto(new_code.parsedcode))

Expand Down
18 changes: 18 additions & 0 deletions test/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,22 @@ import PlutoDependencyExplorer as PDE
order = PDE.topological_order(topology);

@test order.runnable == notebook[[2, 3, 1]]

notebook = SimpleCell.([
"foo"
"foo = 3"
]);

empty_topology = PDE.NotebookTopology{SimpleCell}();

topology = PDE.updated_topology(
empty_topology,
notebook, notebook;
get_code_str = c -> c.code,
get_code_expr = c -> Meta.parse(c.code),
);

order = PDE.topological_order(topology);

@test order.runnable == notebook[[2, 1]]
end

0 comments on commit d1b8b26

Please sign in to comment.