refactor globals

This commit is contained in:
Dmitry Vasilev
2023-06-15 23:55:06 +03:00
parent fdbe01249d
commit 2f5db0452c
7 changed files with 75 additions and 40 deletions

View File

@@ -77,7 +77,7 @@ const run_code = (s, dirty_files) => {
return s.files[module]
}
})
}, s.globals)
const state = {
...s,
@@ -839,12 +839,15 @@ const create_file = (state, dir, current_module) => {
return {...load_dir(state, dir), current_module}
}
const open_run_window = state => {
const open_run_window = (state, globals) => {
// After we reopen run window, we should reload external modules in the
// context of new window. Clear external_imports_cache
return run_code({
...state,
globals,
external_imports_cache: null,
// Bust parse result cache because list of globals may change
parse_result: null,
})
}