Skip to content

fix: solve shows lesson-only files empty #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/cli/tests/__snapshots__/create-tutorial.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ exports[`create a project 1`] = `
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/index.html",
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/unicorn.js",
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/windows_xp.png",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src/index.html",
"src/content/tutorial/1-basics/1-introduction/2-foo/content.mdx",
"src/content/tutorial/1-basics/1-introduction/3-bar",
"src/content/tutorial/1-basics/1-introduction/3-bar/_files",
Expand Down Expand Up @@ -97,6 +100,7 @@ exports[`create and build a project 1`] = `
"1-basics-1-introduction-1-welcome-files.json",
"1-basics-1-introduction-1-welcome-solution.json",
"1-basics-1-introduction-2-foo-files.json",
"1-basics-1-introduction-2-foo-solution.json",
"1-basics-1-introduction-3-bar-files.json",
"1-basics/2-foo",
"1-basics/2-foo/1-welcome",
Expand Down Expand Up @@ -185,6 +189,9 @@ exports[`create and eject a project 1`] = `
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/index.html",
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/unicorn.js",
"src/content/tutorial/1-basics/1-introduction/2-foo/_files/src/windows_xp.png",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src",
"src/content/tutorial/1-basics/1-introduction/2-foo/_solution/src/index.html",
"src/content/tutorial/1-basics/1-introduction/2-foo/content.mdx",
"src/content/tutorial/1-basics/1-introduction/3-bar",
"src/content/tutorial/1-basics/1-introduction/3-bar/_files",
Expand Down Expand Up @@ -276,6 +283,7 @@ exports[`create, eject and build a project 1`] = `
"1-basics-1-introduction-1-welcome-files.json",
"1-basics-1-introduction-1-welcome-solution.json",
"1-basics-1-introduction-2-foo-files.json",
"1-basics-1-introduction-2-foo-solution.json",
"1-basics-1-introduction-3-bar-files.json",
"1-basics/2-foo",
"1-basics/2-foo/1-welcome",
Expand Down
6 changes: 4 additions & 2 deletions packages/runtime/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ export class TutorialStore {
return;
}

this._editorStore.setDocuments(this._lessonSolution);
this._runner.updateFiles(this._lessonSolution);
const files = { ...this._lessonFiles, ...this._lessonSolution };

this._editorStore.setDocuments(files);
this._runner.updateFiles(files);
}

setSelectedFile(filePath: string | undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h1>Solution</h1>
<p>Other files should be visible as well</p>
</body>
</html>