Skip to content

Commit b5d438e

Browse files
fix(mobile): recovered drafts keep composer recall provenance
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 22f2c57 commit b5d438e

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎apps/mobile/src/state/use-composer-drafts.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ vi.mock("../features/sharing/incoming-share-storage", () => ({
167167
import type { DraftComposerAttachment } from "../lib/composerImages";
168168
import {
169169
collectComposerContextReferences,
170+
composerRecallContext,
170171
formatComposerContextReference,
171172
} from "@t3tools/shared/composerContextReferences";
172173
import { appAtomRegistry } from "./atom-registry";
@@ -473,6 +474,18 @@ describe("mobile composer drafts", () => {
473474
},
474475
);
475476

477+
it("keeps recall provenance through a recovered draft's unchanged save", () => {
478+
const context = { version: 1, records: [], composerRecall: " original\n" } as const;
479+
const restored = decodePersistedComposerState({
480+
schemaVersion: 1,
481+
drafts: { thread: { text: "original", attachments: [], context } },
482+
}).drafts.thread!;
483+
expect(
484+
composerRecallContext("original", restored.text, restored.context, "original")
485+
?.composerRecall,
486+
).toBe(" original\n");
487+
});
488+
476489
it("retains a pick matching cached state until the live shell confirms it", () => {
477490
const environmentId = EnvironmentId.make("environment-1");
478491
const threadId = ThreadId.make("thread-1");

‎apps/mobile/src/state/use-composer-drafts.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ const ComposerDraftProjectSchema = Schema.Struct({
387387
// attachments. Keep every payload reloadable; send guards ask the user to trim the draft.
388388
const PersistedComposerContextSchema = Schema.Struct({
389389
version: Schema.Literal(1),
390+
composerRecall: OrchestrationMessageContext.fields.composerRecall,
390391
records: ForwardCompatibleArray(ComposerContextRecord),
391392
});
392393

0 commit comments

Comments
 (0)