# fix\(mobile\): keep id-keyed drafts owned by their environment and project · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/5d256e4c87996b79e52cde15403e3d2752e81308)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 5d256e4c87996b79e52cde15403e3d2752e81308

Requested commit: 5d256e4c87996b79e52cde15403e3d2752e81308

Commit: 5d256e4c87996b79e52cde15403e3d2752e81308

Tree: 7f041aee2ed3a2877a4716d19000d33831f067bb

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(mobile): keep id-keyed drafts owned by their environment and project

Follow-ups from review on the id-keyed draft change:

- composerDraftEnvironmentId read the environment out of the key, so an
  id-keyed new-task draft had no owner: attachment uploads never started
  and sign-out archival skipped the draft while cleanup deleted it. It now
  takes the draft and reads the project stamp, falling back to the legacy
  key shape only for drafts not yet migrated.
- Archived signed-out drafts get the same legacy-key migration as live
  ones, so they surface and open after restore.
- Switching environments retargets the active draft to the matched
  project, like switching projects does, instead of leaving the stamp on
  the old machine.
- openDraft refuses a draft whose stamped project is not loaded rather
  than letting the composer fall back to the environment's first project.
- The draft screen waits for draft hydration before deciding a draftId is
  gone, and keeps retrying while the project list is still empty, so a
  cold launch into a Draft row lands on it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

```

## Parents

- [22c1f6750db3ef8ddc708977aa0e9d7d549591b8](https://git.cafe/pingdotgg/t3code/commit/22c1f6750db3ef8ddc708977aa0e9d7d549591b8?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/5d256e4c87996b79e52cde15403e3d2752e81308?format=markdown)
