Skip to content

Commit

Permalink
add comment about losing cells in save_notebook (#2692)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw authored Oct 30, 2023
1 parent 557263d commit 4a8e79a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/notebook/saving and loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ function save_notebook(io::IO, notebook::Notebook)
println(io)

cells_ordered = collect(topological_order(notebook))
# TODO: add test for this case
if length(cells_ordered) != length(notebook.cells)

# NOTE: the notebook topological is cached on every update_dependency! call
# .... so it is possible that a cell was added/removed since this last update.
# .... in this case, it will not contain that cell since it is build from its
# .... store notebook topology. therefore, we compute an updated topological
# .... order in this unlikely case.
if length(cells_ordered) != length(notebook.cells_dict)
cells = notebook.cells
updated_topo = updated_topology(notebook.topology, notebook, cells)
cells_ordered = collect(topological_order(updated_topo, cells))
Expand Down

0 comments on commit 4a8e79a

Please sign in to comment.