diff --git a/src/runner/PlutoRunner/src/evaluation/deleting globals.jl b/src/runner/PlutoRunner/src/evaluation/deleting globals.jl index b918d80fe..0e8ce4553 100644 --- a/src/runner/PlutoRunner/src/evaluation/deleting globals.jl +++ b/src/runner/PlutoRunner/src/evaluation/deleting globals.jl @@ -34,13 +34,11 @@ function move_vars( old_workspace = getfield(Main, old_workspace_name) new_workspace = getfield(Main, new_workspace_name) - do_reimports(new_workspace, module_imports_to_move) - for cell_id in cells_to_macro_invalidate delete!(cell_expanded_exprs, cell_id) end foreach(unregister_js_link, cells_to_js_link_invalidate) - + # TODO: delete Core.eval(new_workspace, :(import ..($(old_workspace_name)))) @@ -96,6 +94,8 @@ function move_vars( end end + do_reimports(new_workspace, module_imports_to_move) + revise_if_possible(new_workspace) end diff --git a/test/React.jl b/test/React.jl index 4aa0bac07..1015c7f7a 100644 --- a/test/React.jl +++ b/test/React.jl @@ -1053,4 +1053,40 @@ import Pluto.Configuration: Options, EvaluationOptions @test startswith(notebook.cells[2].output.body[:msg], "syntax:") end end + + @testset "using .LocalModule" begin + notebook = Notebook(Cell.([ + """ + begin + @eval module LocalModule + const x = :exported + export x + end + using .LocalModule + end + """, + "x" + ])) + update_run!(🍭, notebook, notebook.cells) + @test notebook.cells[1] |> noerror + @test notebook.cells[2] |> noerror + + output_2 = notebook.cells[2].output.body + @test contains(output_2, "exported") + + setcode!( + notebook.cells[1], + """ + begin + @eval module LocalModule + const x = :not_exported + end + using .LocalModule + end + """, + ) + + update_run!(🍭, notebook, [notebook.cells[1]]) + @test expecterror(UndefVarError(:x), notebook.cells[end]) + end end