Skip to content

Commit 6a045c1

Browse files
committed
fix: migrate button, repl type and upgrade to ^5.0.0
1 parent 1541034 commit 6a045c1

File tree

4 files changed

+112
-48
lines changed

4 files changed

+112
-48
lines changed

apps/svelte.dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"prettier-plugin-svelte": "^3.2.4",
7171
"satori": "^0.10.13",
7272
"satori-html": "^0.3.2",
73-
"svelte": "5.0.0-next.269",
73+
"svelte": "5.0.0",
7474
"svelte-check": "^4.0.0",
7575
"svelte-preprocess": "^5.1.4",
7676
"tiny-glob": "^0.2.9",

apps/svelte.dev/src/routes/(authed)/playground/[id]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
let { data } = $props();
1414
15-
let repl = $state() as Repl;
15+
let repl = $state() as ReturnType<typeof Repl>;
1616
let name = $state(data.gist.name);
1717
let modified = $state(false);
1818
let version = data.version;

packages/editor/src/lib/Workspace.svelte.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,11 @@ export class Workspace {
300300
this.#view = null;
301301
}
302302

303-
update_file(file: File) {
304-
if (file.name === this.#current.name) {
305-
// TODO this line causes the editor to keep losign
306-
// focus and I have no idea why. It seems important,
307-
// but it also doesn't appear to break anything
308-
// if we comment it out?
309-
// this.#current = file;
303+
update_file(file: File, from_codemirror = false) {
304+
if (file.name === this.#current.name && !from_codemirror) {
305+
// we don't want to update the file if the update comes from
306+
// codemirror or it will loose focus
307+
this.#current = file;
310308
}
311309

312310
this.#files = this.#files.map((old) => {
@@ -364,10 +362,13 @@ export class Workspace {
364362
if (update.docChanged) {
365363
const state = this.#view!.state!;
366364

367-
this.update_file({
368-
...this.#current,
369-
contents: state.doc.toString()
370-
});
365+
this.update_file(
366+
{
367+
...this.#current,
368+
contents: state.doc.toString()
369+
},
370+
true
371+
);
371372

372373
// preserve undo/redo across files
373374
this.states.set(this.#current.name, state);

pnpm-lock.yaml

Lines changed: 98 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)