Skip to content

Commit 60f86a2

Browse files
committed
fix(academy): course not-found metadata title; try-finally guard in mock run loop
1 parent 668b719 commit 60f86a2

2 files changed

Lines changed: 21 additions & 19 deletions

File tree

apps/sim/app/academy/(catalog)/[courseSlug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function generateStaticParams() {
1616
export async function generateMetadata({ params }: CourseDetailPageProps): Promise<Metadata> {
1717
const { courseSlug } = await params
1818
const course = getCourse(courseSlug)
19-
if (!course) return {}
19+
if (!course) return { title: 'Course Not Found' }
2020
return {
2121
title: course.title,
2222
description: course.description,

apps/sim/app/academy/components/sandbox-canvas-provider.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -306,25 +306,27 @@ export function SandboxCanvasProvider({
306306
clearWorkflowConsole(workflowId)
307307
useTerminalConsoleStore.setState({ isOpen: true })
308308

309-
for (let i = 0; i < plan.length; i++) {
310-
const step = plan[i]
311-
setActiveBlocks(workflowId, new Set([step.blockId]))
312-
await new Promise((resolve) => setTimeout(resolve, step.delay))
313-
addConsole({
314-
workflowId,
315-
blockId: step.blockId,
316-
blockName: workflowBlocks[step.blockId]?.name ?? step.blockType,
317-
blockType: step.blockType,
318-
executionOrder: i,
319-
output: step.output,
320-
success: true,
321-
durationMs: step.delay,
322-
})
323-
setActiveBlocks(workflowId, new Set())
309+
try {
310+
for (let i = 0; i < plan.length; i++) {
311+
const step = plan[i]
312+
setActiveBlocks(workflowId, new Set([step.blockId]))
313+
await new Promise((resolve) => setTimeout(resolve, step.delay))
314+
addConsole({
315+
workflowId,
316+
blockId: step.blockId,
317+
blockName: workflowBlocks[step.blockId]?.name ?? step.blockType,
318+
blockType: step.blockType,
319+
executionOrder: i,
320+
output: step.output,
321+
success: true,
322+
durationMs: step.delay,
323+
})
324+
setActiveBlocks(workflowId, new Set())
325+
}
326+
} finally {
327+
setIsExecuting(workflowId, false)
328+
isMockRunningRef.current = false
324329
}
325-
326-
setIsExecuting(workflowId, false)
327-
isMockRunningRef.current = false
328330
}, [workflowId, exerciseConfig.validationRules, exerciseConfig.mockOutputs])
329331
handleMockRunRef.current = handleMockRun
330332

0 commit comments

Comments
 (0)