fix(notetaker): flush debounced autosave + carry course context to tutor#207
Conversation
|
Warning Review limit reached
More reviews will be available in 51 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
frontend | b54888a | Commit Preview URL Branch Preview URL |
Jun 12 2026, 05:03 AM |
The 800ms-debounced autosave cleared its timer on unmount/note-switch without firing, so edits typed within the window were lost while the footer still read Saved. Track the latest pending patch per note and flush it on note change, on unmount, and before send-to-tutor / generate-quiz navigation. The tab-close flush uses a keepalive request so it survives the unload, and the footer now reflects unsaved/saving state.
LearnInner read topic/mode/suggest from the URL but never course, so a
note sent to the tutor lost its course context: selectedCourseId stayed
empty and the session started without a courseId. Seed selectedCourseId
from searchParams.get("course") so the carried-over course flows into
startSession and the course selector.
a0b911e to
b54888a
Compare
What
Fixes two notetaker data-loss bugs from #133:
patchNotecleared its pending timer on unmount / note-switch without flushing, so edits typed within the debounce window were silently lost while the footer still read "Saved" — including when clicking Send to tutor / Generate quiz, whichrouter.pushand unmount the page.onSendToTutorpushes/learn?topic=…&course=<id>, butLearnInneronly readtopic/mode/suggest.selectedCourseIdstayed""and the session started with nocourseId.Why
Users lost recent edits when navigating away from a note, and tutor sessions launched from a note silently dropped the note's course, weakening the learning context. Both are correctness/data-integrity issues (P2).
How verified
pagehide(tab close), and before send-to-tutor / generate-quiz navigation. Pending patches are merged so partial title/body/tags edits aren't lost. Thepagehideflush uses akeepaliverequest so it survives the unload.Saved/Unsaved changes/Saving…) so it no longer falsely claims "Saved".LearnInnerseedsselectedCourseIdfromsearchParams.get("course"), so the carried-over course flows intostartSessionand the course selector.cd frontend && npx tsc --noEmit→ clean (exit 0).cd frontend && npx vitest run→ 5 files, 37 tests passing.Closes #133