fix(storage): local disk persistence for classroom data generated via browser UI flow (#53)#213
Open
AsadAliQuant wants to merge 1 commit intoTHU-MAIC:mainfrom
Open
Conversation
… browser UI flow (THU-MAIC#53)
This was referenced Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #53 — classrooms generated via the browser UI are now persisted to
data/classrooms/{id}.jsonon the server disk after generation completes.Related Issues
Closes #53
Changes
lib/hooks/use-scene-generator.ts— addedPOST /api/classroomcall after all scenes finish generating in the browser UI flow, triggering the existingpersistClassroom()which writes the classroom JSON to disk atomicallyRoot Cause
OpenMAIC has two generation flows:
classroom-generation.ts, already calledpersistClassroom()correctlyuse-scene-generator.ts, saved to IndexedDB only and never wrote to diskThis meant every classroom created through the normal browser UI was only accessible in the browser that generated it — switching to another browser shows "Classroom not found" because IndexedDB is local to each browser.
Type of Change
Verification
Steps to reproduce / test
data/classrooms/{id}.jsonis created on diskWhat I personally verified
data/classrooms/{id}.jsoncreated with full course dataEvidence
npx tsc --noEmitpasses — no new TypeScript errorsNotes
Zero new dependencies. No schema changes. One file changed.
Opening a persisted course in another browser requires pasting the direct classroom URL (e.g.
http://localhost:3000/classroom/{id}). The home page course list still reads from IndexedDB only — showing disk-persisted courses on the home page is a separate improvement.