# Unify draft and persisted thread terminal flow · gitcafe/t3code

[View on GitCafe](https://git.cafe/gitcafe/t3code/commit/ad4d12cf94e8b1cbd679372ed2bcf453b531b90f)

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

Visibility: public

Requested revision: ad4d12cf94e8b1cbd679372ed2bcf453b531b90f

Requested commit: ad4d12cf94e8b1cbd679372ed2bcf453b531b90f

Commit: ad4d12cf94e8b1cbd679372ed2bcf453b531b90f

Tree: a17ab606a745607cc27b6693c04a62b356493ce0

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
Unify draft and persisted thread terminal flow

- Add shared threadTerminalState.ts: ThreadTerminalState type, default state,
  normalize helpers, and single reduceThreadTerminalState() used by both flows
- Refactor store.ts to use shared terminal reducer and helpers; terminal
  actions map to reduceThreadTerminalState(threadTerminalSlice(thread), action)
- Make draftThreadTerminalState.ts re-export shared module (same shape/actions)
- Add terminalState to composer draft store: getDraftThreadTerminalState,
  setDraftThreadTerminalAction, clearDraftThreadTerminalState; draft thread
  shape matches Thread terminal slice
- ChatView: move draft terminal from useState into composer draft store; use
  same actions for draft and persisted; hydrate then clear draft terminal
  when reconciling server state

Made-with: Cursor

```

## Parents

- [f6fd760e4eb9e18dd7b89cf45f478835d20145f8](https://git.cafe/gitcafe/t3code/commit/f6fd760e4eb9e18dd7b89cf45f478835d20145f8?format=markdown)

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