Skip to content

Commit b464a90

Browse files
claudebrenelz
andcommitted
tutorial: load ./api and ./server as jsx tabs
solid-repl resolves extensionless imports to jsx tabs only, so the .js helper files in two lessons failed to import. From #1672. Co-authored-by: Brenley Dueck <brenleydueck@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWPLXmEUSKddsQSHkzN
1 parent 3d0dbca commit b464a90

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎src/tutorials/optimistic-stores.json‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
},
88
{
99
"name": "api",
10-
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend server holding the todo list. Saves take 800ms.\nlet serverTodos = [\n { id: 1, text: 'Learn actions', done: true },\n { id: 2, text: 'Learn optimistic stores', done: false },\n];\nlet nextId = 3;\nexport const api = {\n failNext: false,\n async list() {\n await sleep(100);\n return structuredClone(serverTodos);\n },\n async toggle(id) {\n await sleep(800);\n if (api.failNext) {\n api.failNext = false;\n throw new Error('The server rejected that change.');\n }\n serverTodos = serverTodos.map((t) => (t.id === id ? { ...t, done: !t.done } : t));\n },\n async add(todo) {\n await sleep(800);\n serverTodos = [...serverTodos, todo];\n },\n};\n\nexport const newId = () => nextId++;\n",
11-
"type": "js"
10+
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend server holding the todo list. Saves take 800ms.\nlet serverTodos = [\n { id: 1, text: 'Learn actions', done: true },\n { id: 2, text: 'Learn optimistic stores', done: false },\n];\nlet nextId = 3;\nexport const api = {\n failNext: false,\n async list() {\n await sleep(100);\n return structuredClone(serverTodos);\n },\n async toggle(id) {\n await sleep(800);\n if (api.failNext) {\n api.failNext = false;\n throw new Error('The server rejected that change.');\n }\n serverTodos = serverTodos.map((t) => (t.id === id ? { ...t, done: !t.done } : t));\n },\n async add(todo) {\n await sleep(800);\n serverTodos = [...serverTodos, todo];\n },\n};\n\nexport const newId = () => nextId++;\n"
1211
},
1312
{
1413
"name": "styles",
@@ -25,8 +24,7 @@
2524
},
2625
{
2726
"name": "api",
28-
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend server holding the todo list. Saves take 800ms.\nlet serverTodos = [\n { id: 1, text: 'Learn actions', done: true },\n { id: 2, text: 'Learn optimistic stores', done: false },\n];\nlet nextId = 3;\nexport const api = {\n failNext: false,\n async list() {\n await sleep(100);\n return structuredClone(serverTodos);\n },\n async toggle(id) {\n await sleep(800);\n if (api.failNext) {\n api.failNext = false;\n throw new Error('The server rejected that change.');\n }\n serverTodos = serverTodos.map((t) => (t.id === id ? { ...t, done: !t.done } : t));\n },\n async add(todo) {\n await sleep(800);\n serverTodos = [...serverTodos, todo];\n },\n};\n\nexport const newId = () => nextId++;\n",
29-
"type": "js"
27+
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend server holding the todo list. Saves take 800ms.\nlet serverTodos = [\n { id: 1, text: 'Learn actions', done: true },\n { id: 2, text: 'Learn optimistic stores', done: false },\n];\nlet nextId = 3;\nexport const api = {\n failNext: false,\n async list() {\n await sleep(100);\n return structuredClone(serverTodos);\n },\n async toggle(id) {\n await sleep(800);\n if (api.failNext) {\n api.failNext = false;\n throw new Error('The server rejected that change.');\n }\n serverTodos = serverTodos.map((t) => (t.id === id ? { ...t, done: !t.done } : t));\n },\n async add(todo) {\n await sleep(800);\n serverTodos = [...serverTodos, todo];\n },\n};\n\nexport const newId = () => nextId++;\n"
3028
},
3129
{
3230
"name": "styles",

‎src/tutorials/until.json‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
},
88
{
99
"name": "server",
10-
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend chat server. Sending returns quickly, but the message only\n// shows up in the live feed a second later, once the server has stored it.\nlet messages = [{ id: 'welcome', text: 'Welcome to the chat!' }];\nconst listeners = new Set();\n\nexport const server = {\n async send(message) {\n await sleep(150);\n setTimeout(() => {\n messages = [...messages, message];\n for (const listener of listeners) listener(messages);\n }, 1000);\n },\n // The live feed: yields the full list now, then again after every change.\n async *watch() {\n yield messages;\n while (true) {\n yield await new Promise((resolve) => {\n const listener = (list) => {\n listeners.delete(listener);\n resolve(list);\n };\n listeners.add(listener);\n });\n }\n },\n};\n",
11-
"type": "js"
10+
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend chat server. Sending returns quickly, but the message only\n// shows up in the live feed a second later, once the server has stored it.\nlet messages = [{ id: 'welcome', text: 'Welcome to the chat!' }];\nconst listeners = new Set();\n\nexport const server = {\n async send(message) {\n await sleep(150);\n setTimeout(() => {\n messages = [...messages, message];\n for (const listener of listeners) listener(messages);\n }, 1000);\n },\n // The live feed: yields the full list now, then again after every change.\n async *watch() {\n yield messages;\n while (true) {\n yield await new Promise((resolve) => {\n const listener = (list) => {\n listeners.delete(listener);\n resolve(list);\n };\n listeners.add(listener);\n });\n }\n },\n};\n"
1211
},
1312
{
1413
"name": "styles",
@@ -25,8 +24,7 @@
2524
},
2625
{
2726
"name": "server",
28-
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend chat server. Sending returns quickly, but the message only\n// shows up in the live feed a second later, once the server has stored it.\nlet messages = [{ id: 'welcome', text: 'Welcome to the chat!' }];\nconst listeners = new Set();\n\nexport const server = {\n async send(message) {\n await sleep(150);\n setTimeout(() => {\n messages = [...messages, message];\n for (const listener of listeners) listener(messages);\n }, 1000);\n },\n // The live feed: yields the full list now, then again after every change.\n async *watch() {\n yield messages;\n while (true) {\n yield await new Promise((resolve) => {\n const listener = (list) => {\n listeners.delete(listener);\n resolve(list);\n };\n listeners.add(listener);\n });\n }\n },\n};\n",
29-
"type": "js"
27+
"content": "const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\n// A pretend chat server. Sending returns quickly, but the message only\n// shows up in the live feed a second later, once the server has stored it.\nlet messages = [{ id: 'welcome', text: 'Welcome to the chat!' }];\nconst listeners = new Set();\n\nexport const server = {\n async send(message) {\n await sleep(150);\n setTimeout(() => {\n messages = [...messages, message];\n for (const listener of listeners) listener(messages);\n }, 1000);\n },\n // The live feed: yields the full list now, then again after every change.\n async *watch() {\n yield messages;\n while (true) {\n yield await new Promise((resolve) => {\n const listener = (list) => {\n listeners.delete(listener);\n resolve(list);\n };\n listeners.add(listener);\n });\n }\n },\n};\n"
3028
},
3129
{
3230
"name": "styles",

0 commit comments

Comments
 (0)