We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e7100f0 commit b507464Copy full SHA for b507464
packages/repl/src/lib/Workspace.svelte.ts
@@ -425,13 +425,9 @@ export class Workspace {
425
throw new Error('Workspace must have at least one file');
426
}
427
428
- if (selected) {
429
- const file = files.find((file) => is_file(file) && file.name === selected);
430
-
431
- if (!file) {
432
- throw new Error(`Invalid selection ${selected}`);
433
- }
434
- this.#select(file as File);
+ const matching_file = selected && files.find((file) => is_file(file) && file.name === selected);
+ if (matching_file) {
+ this.#select(matching_file as File);
435
} else {
436
this.#select(first);
437
0 commit comments