Repository navigation
fix(web): disable transcript editor during pending saves to prevent discarding later typing (#3502) - #3542
fix(web): disable transcript editor during pending saves to prevent discarding later typing (#3502)#3542ghazy2001 wants to merge 2 commits into
Conversation
…iscarding later typing (CapSoftware#3502) When saving a transcript cue correction, the editor previously remained writable while the request was in flight. Any edits typed during the save were discarded when the earlier request resolved and closed the editor. Additionally, triggering an edit on another cue during a pending save could cause its draft to be cleared. - Disable the active cue textarea while isSaving is true - Hide and disable cue edit actions across other transcript rows while isSaving is true - Guard startEditing, cancelEditing, and handleTranscriptClick against running during pending saves - Capture entryIdToSave in saveEdit and only close the editor if the active entry still matches the saved entry Closes CapSoftware#3502
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
| entry={entry} | ||
| selected={selectedEntry === entry.id} | ||
| canEdit={canEdit} | ||
| canEdit={canEdit && !isSaving} |
There was a problem hiding this comment.
Existing transcript test fails
The pending-save test in share-transcript-rendering.test.ts:299 calls editCue(3) while a save is pending. This change removes that row's edit button, so the helper throws Missing edit button before the test finishes. Update the test to expect editing to stay blocked, check that the textarea is disabled, and then resolve the save.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx
Line: 824
Comment:
**Existing transcript test fails**
The pending-save test in `share-transcript-rendering.test.ts:299` calls `editCue(3)` while a save is pending. This change removes that row's edit button, so the helper throws `Missing edit button` before the test finishes. Update the test to expect editing to stay blocked, check that the textarea is disabled, and then resolve the save.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Addressed in commit \2c33594b: updated test assertions in \share-transcript-rendering.test.ts\ to verify the active textarea is disabled, other cue edit buttons remain blocked (null) during pending saves, and then resolves the save cleanly.
Summary
Fixes #3502
Linear: CAP-949
When editing a transcript cue in the share page (
apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx), saving the edit sends an async update request viaupdateTranscriptMutation.mutateAsync(...).While the save request was in flight:
Transcriptreplaced the cue with the saved response snapshot.setEditingEntry(null)cleared the active edit state unconditionally when the previous save completed.Changes
apps/web/app/s/[videoId]/_components/tabs/transcript-row.tsx:disabled={isSaving}on the editing<textarea>withdisabled:cursor-not-allowed disabled:opacity-50styling, visually indicating save in flight and preventing user keystrokes from being discarded on settlement.apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx:handleTranscriptClick,startEditing,cancelEditing, andsaveEditagainstisSaving.entryIdToSave = editingEntrybefore initiating the async mutation; only clearseditingEntry(setEditingEntry(null)) ifeditingEntry === entryIdToSavewhen the mutation settles.canEdit={canEdit && !isSaving}toTranscriptRowto disable action buttons while a cue save is in progress.Test plan
bun test apps/web/__tests__/unit/transcript-vtt.test.ts(4 passed in 279ms)bun test apps/web/__tests__/unit/transcript-text.test.ts(9 passed in 160ms)isSaving === trueand re-enabled once mutation finishes.Update the existing pending-save test before merging.
Findings
Fix with agent prompt
Summary
The PR prevents typing and switching transcript rows while a save is pending.
ghazy2001explicitly describes blocking other transcript rows during saves as intentional.Tests were inspected, not run.
Reviews (1) · Last reviewed commit: "fix(web): disable transcript editor duri..." · Reviewed by Greptile