Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

queued-edit-draft-key.ts

20 lines791 Bytes

1/**
2 * The draft key a queued-message edit borrows.
3 *
4 * `<environmentId>:<threadId>~queued-edit~<runId>`: the marker holds no colon,
5 * so `composerDraftEnvironmentId` still reads the environment from the segment
6 * before the last colon and attachment uploads keep working, while the user's
7 * own draft for the thread stays untouched under its own key.
8 *
9 * Lives apart from the edit session state so the draft store can recognize
10 * these keys without importing it.
11 */
12const QUEUED_EDIT_DRAFT_MARKER = "~queued-edit~";
13​
14export function queuedEditDraftKey(threadKey: string, runId: string): string {
15 return `${threadKey}${QUEUED_EDIT_DRAFT_MARKER}${runId}`;
17​
18export function isQueuedEditDraftKey(draftKey: string): boolean {
19 return draftKey.includes(QUEUED_EDIT_DRAFT_MARKER);