Repository navigation
fix(web): keep script-only drafts reachable in the sidebar #25272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
07a1df5
47eafac
68d75cc
9fa8830
8cb07b3
530e8b1
e17c767
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,9 @@ export function discardComposerDraft(target: ComposerThreadTarget): void { | |
| const store = useComposerDraftStore.getState(); | ||
| const key = resolveComposerDraftKey(store, target); | ||
| const draft = key === null ? undefined : store.draftsByThreadKey[key]; | ||
| if (key === null || !draft) return; | ||
| if (key === null) return; | ||
| const session = store.draftThreadsByThreadKey[key]; | ||
| if (!draft && !session) return; | ||
| const logicalProjectKeys = Object.entries(store.logicalProjectDraftThreadKeyByLogicalProjectKey) | ||
| .filter(([, draftKey]) => draftKey === key) | ||
| .map(([logicalProjectKey]) => logicalProjectKey); | ||
|
|
@@ -30,6 +31,7 @@ export function discardComposerDraft(target: ComposerThreadTarget): void { | |
| } | ||
|
|
||
| const releaseDiscardedDraft = () => { | ||
| if (!draft) return; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| releaseDraftAttachments([...draft.images, ...draft.files]); | ||
| // Draft-session removal already revoked these previews. | ||
| if (!discardsSession) { | ||
|
|
@@ -57,19 +59,21 @@ export function discardComposerDraft(target: ComposerThreadTarget): void { | |
| logicalProjectDraftThreadKeyByLogicalProjectKey[logicalProjectKey] ??= key; | ||
| } | ||
| return { | ||
| draftsByThreadKey: { | ||
| ...state.draftsByThreadKey, | ||
| [key]: discardsSession | ||
| ? { | ||
| ...draft, | ||
| images: draft.images.map((image) => | ||
| image.previewUrl.startsWith("blob:") | ||
| ? { ...image, previewUrl: URL.createObjectURL(image.file) } | ||
| : image, | ||
| ), | ||
| } | ||
| : draft, | ||
| }, | ||
| draftsByThreadKey: draft | ||
| ? { | ||
| ...state.draftsByThreadKey, | ||
| [key]: discardsSession | ||
| ? { | ||
| ...draft, | ||
| images: draft.images.map((image) => | ||
| image.previewUrl.startsWith("blob:") | ||
| ? { ...image, previewUrl: URL.createObjectURL(image.file) } | ||
| : image, | ||
| ), | ||
| } | ||
| : draft, | ||
| } | ||
| : state.draftsByThreadKey, | ||
| draftThreadsByThreadKey: session | ||
| ? { ...state.draftThreadsByThreadKey, [key]: session } | ||
| : state.draftThreadsByThreadKey, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: pingdotgg/t3code
Length of output: 18632
Script executed:
Repository: pingdotgg/t3code
Length of output: 24258
Script executed:
Repository: pingdotgg/t3code
Length of output: 21221
Script executed:
Repository: pingdotgg/t3code
Length of output: 22137
Script executed:
Repository: pingdotgg/t3code
Length of output: 24964
Script executed:
Repository: pingdotgg/t3code
Length of output: 1077
Script executed:
Repository: pingdotgg/t3code
Length of output: 11985
Script executed:
Repository: pingdotgg/t3code
Length of output: 13822
Script executed:
Repository: pingdotgg/t3code
Length of output: 15875
Script executed:
Repository: pingdotgg/t3code
Length of output: 5538
Preserve or close terminals when discarding a session.
If a user discards an inactive draft with a running script, the draft session and its sidebar row disappear, but the terminal keeps running. After Undo expires, the user cannot return to the terminal to inspect or stop the script.
Keep the terminal reachable, or close it when discard commits. Preserve the terminal while Undo is available.