[PR #1440] [MERGED] fix(staffml): re-nest worker response — practice page white-screen #7309

Closed
opened 2026-04-24 17:25:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1440
Author: @profvjreddi
Created: 4/22/2026
Status: Merged
Merged: 4/22/2026
Merged by: @profvjreddi

Base: devHead: fix/hydration-shape-mismatch


📝 Commits (1)

  • 2cf5444 fix(staffml): re-nest worker response in getQuestionFullDetail

📊 Changes

1 file changed (+21 additions, -4 deletions)

View changed files

📝 interviews/staffml/src/lib/corpus.ts (+21 -4)

📄 Description

Bug

Loading any hydrated question on /practice white-screens the page. Reported on https://mlsysbook.ai/staffml/practice?q=tinyml-exp2-reca-0117.

Root cause

Worker response and site Question type have different shapes:

Worker returns (D1 rows are flat):

{"scenario": "...", "common_mistake": "...", "realistic_solution": "...", "napkin_math": "..."}

Site expects:

{"scenario": "...", "details": {"common_mistake": "...", ...}}

getQuestionFullDetail merged them naively, setting details: undefined. First render after hydration → current.details.napkin_math → TypeError.

Fix

Re-nest the flat worker fields into a details object inside getQuestionFullDetail. Preserves MCQ options/correct_index from the summary. Forward-compatible if the worker later emits a nested details object.

Test

  • npx next build succeeds
  • After deploy: /practice?q=tinyml-exp2-reca-0117 renders scenario + details correctly

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1440 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/22/2026 **Status:** ✅ Merged **Merged:** 4/22/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/hydration-shape-mismatch` --- ### 📝 Commits (1) - [`2cf5444`](https://github.com/harvard-edge/cs249r_book/commit/2cf54442bbe8c731182862d4b688522b4b9eae44) fix(staffml): re-nest worker response in getQuestionFullDetail ### 📊 Changes **1 file changed** (+21 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `interviews/staffml/src/lib/corpus.ts` (+21 -4) </details> ### 📄 Description ## Bug Loading any hydrated question on /practice white-screens the page. Reported on https://mlsysbook.ai/staffml/practice?q=tinyml-exp2-reca-0117. ## Root cause Worker response and site Question type have different shapes: **Worker returns** (D1 rows are flat): ```json {"scenario": "...", "common_mistake": "...", "realistic_solution": "...", "napkin_math": "..."} ``` **Site expects:** ```json {"scenario": "...", "details": {"common_mistake": "...", ...}} ``` `getQuestionFullDetail` merged them naively, setting `details: undefined`. First render after hydration → `current.details.napkin_math` → TypeError. ## Fix Re-nest the flat worker fields into a `details` object inside `getQuestionFullDetail`. Preserves MCQ options/correct_index from the summary. Forward-compatible if the worker later emits a nested `details` object. ## Test - [x] `npx next build` succeeds - [ ] After deploy: /practice?q=tinyml-exp2-reca-0117 renders scenario + details correctly --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 17:25:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#7309