# Fix terminal focus on toggle, clean up orphaned terminal state, and revoke optimistic message blob URLs on unmount · gitcafe/t3code

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

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

Visibility: public

Requested revision: 32fe80d1647ea9fb466fe5fab67b74fea78f011b

Requested commit: 32fe80d1647ea9fb466fe5fab67b74fea78f011b

Commit: 32fe80d1647ea9fb466fe5fab67b74fea78f011b

Tree: 28562e51f579392a7960571431efca89630d3f0b

Author: Cursor Agent

Committer: Julius Marminge

## Message

```
Fix terminal focus on toggle, clean up orphaned terminal state, and revoke optimistic message blob URLs on unmount

- Add setTerminalFocusRequestId call when terminal opens via toggle so the
  terminal panel receives focus automatically
- Call clearTerminalState when deleting threads in the Sidebar and add
  removeOrphanedTerminalStates to prune stale entries after read model sync
- Track optimisticUserMessages via ref and revoke their blob URLs in the
  unmount cleanup effect to prevent memory leaks

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>

```

## Parents

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

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