Skip to content

Commit 1728475

Browse files
committed
fix: solve shows lesson-only files empty
1 parent 55430f9 commit 1728475

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

packages/cli/tests/__snapshots__/create-tutorial.test.ts.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ exports[`create a project 1`] = `
4646
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/index.html",
4747
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/unicorn.js",
4848
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/windows_xp.png",
49+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution",
50+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src",
51+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src/index.html",
4952
"src/content/tutorial/1-basics/1-introduction/2-foo/content.mdx",
5053
"src/content/tutorial/1-basics/1-introduction/3-bar",
5154
"src/content/tutorial/1-basics/1-introduction/3-bar/_files",
@@ -97,6 +100,7 @@ exports[`create and build a project 1`] = `
97100
"1-basics-1-introduction-1-welcome-files.json",
98101
"1-basics-1-introduction-1-welcome-solution.json",
99102
"1-basics-1-introduction-2-foo-files.json",
103+
"1-basics-1-introduction-2-foo-solution.json",
100104
"1-basics-1-introduction-3-bar-files.json",
101105
"1-basics/2-foo",
102106
"1-basics/2-foo/1-welcome",
@@ -185,6 +189,9 @@ exports[`create and eject a project 1`] = `
185189
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/index.html",
186190
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/unicorn.js",
187191
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/windows_xp.png",
192+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution",
193+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src",
194+
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src/index.html",
188195
"src/content/tutorial/1-basics/1-introduction/2-foo/content.mdx",
189196
"src/content/tutorial/1-basics/1-introduction/3-bar",
190197
"src/content/tutorial/1-basics/1-introduction/3-bar/_files",
@@ -276,6 +283,7 @@ exports[`create, eject and build a project 1`] = `
276283
"1-basics-1-introduction-1-welcome-files.json",
277284
"1-basics-1-introduction-1-welcome-solution.json",
278285
"1-basics-1-introduction-2-foo-files.json",
286+
"1-basics-1-introduction-2-foo-solution.json",
279287
"1-basics-1-introduction-3-bar-files.json",
280288
"1-basics/2-foo",
281289
"1-basics/2-foo/1-welcome",

packages/runtime/src/store/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ export class TutorialStore {
290290
return;
291291
}
292292

293-
this._editorStore.setDocuments(this._lessonSolution);
294-
this._runner.updateFiles(this._lessonSolution);
293+
const files = { ...this._lessonFiles, ...this._lessonSolution };
294+
295+
this._editorStore.setDocuments(files);
296+
this._runner.updateFiles(files);
295297
}
296298

297299
setSelectedFile(filePath: string | undefined) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
<h1>Solution</h1>
10+
<p>Other files should be visible as well</p>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)