You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seems it's not a bug in TutorialKit but in the way I'm watching the filesystem in my custom component... I'm upgrading stuff and decided to ask Claude Code Opus to have a look:
The issue is that when navigating between lessons, the documents store is completely replaced and lessonFullyLoaded transitions. Your listener in RunSynth.tsx may be set up before the new lesson's filesystem is ready, or it's comparing against stale oldDocuments.
The fix should check lessonFullyLoaded before setting up the listener, or reset the listener when the lesson changes. Here's an improved version:
● Update(src/components/RunSynth.tsx)
⎿ Updated src/components/RunSynth.tsx with 10 additions
8 const terminal = tutorialStore.terminalConfig.value!.panels[1];
9 terminal.input('npm run synth\n');
10 const filePath = '/cdktf.out/stacks/workshop/cdk.tf.json';
11 +
12 + // Capture the current lesson ref to detect if lesson changes during synth
13 + const currentRef = tutorialStore.ref.value;
14 +
15 const stopListening = tutorialStore.documents.listen((newDocuments, oldDocuments) => {
16 + // Abort if lesson has changed
17 + if (tutorialStore.ref.value !== currentRef) {
18 + stopListening();
19 + return;
20 + }
21 +
22 if (!newDocuments[filePath] || !oldDocuments || !oldDocuments[filePath]) {
23 return;
24 }
Activity
AriPerkkio commentedon Jan 13, 2025
This seems to be the root cause indeed:
tutorialkit/packages/runtime/src/store/editor.ts
Lines 148 to 173 in 0e7cf3c
The
onDocumentChangedis not used internally by TutorialKit, it's only available via the experimental API. Fixing this should be quite risk-free.so0k commentedon Dec 16, 2025
seems it's not a bug in TutorialKit but in the way I'm watching the filesystem in my custom component... I'm upgrading stuff and decided to ask Claude Code Opus to have a look: