Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comment about losing cells in save_notebook #2692

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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