Skip to content

Commit 0b09e1f

Browse files
committed
fix(repl): components -> files
1 parent 7cbd36d commit 0b09e1f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sites/svelte.dev/src/routes/(authed)/repl/[id]/AppControls.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
const { login } = getContext('app');
1212
1313
export let user;
14+
15+
/** @type {import('@sveltejs/repl').default} */
1416
export let repl;
1517
export let gist;
1618
export let name;
@@ -38,7 +40,7 @@
3840
async function fork(intentWasSave) {
3941
saving = true;
4042
41-
const { components } = repl.toJSON();
43+
const { files } = repl.toJSON();
4244
4345
try {
4446
const r = await fetch(`/repl/create.json`, {
@@ -49,9 +51,9 @@
4951
},
5052
body: JSON.stringify({
5153
name,
52-
files: components.map((component) => ({
53-
name: `${component.name}.${component.type}`,
54-
source: component.source
54+
files: files.map((file) => ({
55+
name: `${file.name}.${file.type}`,
56+
source: file.source
5557
}))
5658
})
5759
});
@@ -104,7 +106,7 @@
104106
try {
105107
// Send all files back to API
106108
// ~> Any missing files are considered deleted!
107-
const { components } = repl.toJSON();
109+
const { files } = repl.toJSON();
108110
109111
const r = await fetch(`/repl/save/${gist.id}.json`, {
110112
method: 'PUT',
@@ -114,9 +116,9 @@
114116
},
115117
body: JSON.stringify({
116118
name,
117-
files: components.map((component) => ({
118-
name: `${component.name}.${component.type}`,
119-
source: component.source
119+
files: files.map((file) => ({
120+
name: `${file.name}.${file.type}`,
121+
source: file.source
120122
}))
121123
})
122124
});
@@ -145,7 +147,7 @@
145147
async function download() {
146148
downloading = true;
147149
148-
const { components, imports } = repl.toJSON();
150+
const { files: components, imports } = repl.toJSON();
149151
150152
const files = await (await fetch('/svelte-app.json')).json();
151153

0 commit comments

Comments
 (0)