This commit is contained in:
Dmitry Vasilev
2023-07-14 04:14:52 +03:00
parent 255e9414d2
commit ff80294376
2 changed files with 23 additions and 24 deletions

View File

@@ -540,11 +540,11 @@ const change_current_module = (state, current_module) => {
} }
} }
const change_entrypoint = (state, entrypoint) => { const change_entrypoint = (state, entrypoint, current_module = entrypoint) => {
return run_code( return run_code(
{...state, {...state,
entrypoint, entrypoint,
current_module: entrypoint, current_module,
} }
) )
} }

View File

@@ -226,17 +226,11 @@ export class Files {
exec('change_current_module', file.path) exec('change_current_module', file.path)
} }
} else { } else {
if(file.path == null) { if(file.path == null) {
// root of examples dir, do nothing // root of examples dir, do nothing
return } else if(file.path == '') {
}
if(file.path == '') {
exec('change_entrypoint', '') exec('change_entrypoint', '')
return } else {
}
const find_node = n => const find_node = n =>
n.path == file.path n.path == file.path
|| ||
@@ -250,11 +244,16 @@ export class Files {
// in examples mode, on click file we also change entrypoint for // in examples mode, on click file we also change entrypoint for
// simplicity // simplicity
const example = examples.find(e => e.path == example_dir.path) const example = examples.find(e => e.path == example_dir.path)
exec('change_entrypoint', example.entrypoint) exec(
'change_entrypoint',
example.entrypoint,
file.kind == 'directory' ? undefined : file.path
)
if(example.with_app_window && !localStorage.onboarding_open_app_window) { if(example.with_app_window && !localStorage.onboarding_open_app_window) {
this.ui.toggle_open_app_window_tooltip(true) this.ui.toggle_open_app_window_tooltip(true)
} }
} }
}
// Note that we call render_current_module AFTER exec('change_entrypoint'), // Note that we call render_current_module AFTER exec('change_entrypoint'),
// because in case we clicked to example dir, entrypoint would be set, and // because in case we clicked to example dir, entrypoint would be set, and