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

Deleting disabled cell – bad update for indirectly disabled cells and scope #3089

Open
fonsp opened this issue Nov 7, 2024 · 1 comment
Labels
backend Concerning the julia server and runtime bug Something isn't working good first issue Good for newcomers

Comments

@fonsp
Copy link
Owner

fonsp commented Nov 7, 2024

One cell defines x and is disabled, and another cell contains x + 1 (indirectly disabled). When I remove the first cell, the second cell remains indirectly disabled.

The variable x also remains in scope! That's not good

In this video I was not able to reproduce the cell remaining disabled indirectly, but xx stayed in scope:

Schermopname.2024-11-07.om.14.46.47.mov
@fonsp fonsp added bug Something isn't working backend Concerning the julia server and runtime good first issue Good for newcomers labels Nov 7, 2024
@fonsp
Copy link
Owner Author

fonsp commented Nov 7, 2024

The bug is probably in this file:

removed_cells = setdiff(all_cells(old_topology), all_cells(new_topology))
roots = vcat(roots, removed_cells)
# by setting the reactive node and expression caches of deleted cells to "empty", we are essentially pretending that those cells still exist, but now have empty code. this makes our algorithm simpler.
new_topology = PlutoDependencyExplorer.exclude_roots(new_topology, removed_cells)
# find (indirectly) deactivated cells and update their status
indirectly_deactivated = collect(topological_order(new_topology, collect(new_topology.disabled_cells); allow_multiple_defs=true, skip_at_partial_multiple_defs=true))
for cell in indirectly_deactivated
cell.running = false
cell.queued = false
cell.depends_on_disabled_cells = true
end

And you can add a test here:

https://github.com/fonsp/Pluto.jl/blob/main/test/cell_disabling.jl

You can delete a cell in these tests by modifying both notebook.cells_dict and notebook.cell_order.

@fonsp fonsp changed the title Deleting disabled cell does not update indirectly disabled cells Deleting disabled cell does not update indirectly disabled cells, and does not remove the variable Nov 7, 2024
@fonsp fonsp changed the title Deleting disabled cell does not update indirectly disabled cells, and does not remove the variable Deleting disabled cell – bad update for indirectly disabled cells and scope Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Concerning the julia server and runtime bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant