# Files changed · PR \#23103 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/23103/diffs)

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

Visibility: public

[fix\(web\): the branch toolbar and thread details panel stay cached while a reply streams](https://git.cafe/pingdotgg/t3code/pull/23103.md)

Version: 5

Head commit: 937507c6a4cca85c0d72133ac4ddf7ff643172f5

Base commit: 54349ea3e2f4799c90fdb701bfe12e55526bd618

Comparison base: 54349ea3e2f4799c90fdb701bfe12e55526bd618

Showing up to 20 entries from this revision. If the pull request changes, reopen the first page before continuing.

## apps/web/src/components/chat/useComposerSelection.ts

Status: modified; +6; −3

```diff
@@ -237,12 +237,15 @@
   };
   const onEnvModeChangeStable = useStableCallback(onEnvModeChange);
 
+  // Reads only the id: the shell changes on every streamed event, and a new handler
+  // re-renders the branch toolbar and thread details panel with it.
+  const activeThreadId = activeThread?.id;
   const onStartFromOriginChange = (nextStartFromOrigin: boolean) => {
-    if (canOverrideServerThreadEnvMode && activeThread) {
+    if (canOverrideServerThreadEnvMode && activeThreadId !== undefined) {
       setPendingServerThreadStartFromOriginByThreadId((current) =>
-        current[activeThread.id] === nextStartFromOrigin
+        current[activeThreadId] === nextStartFromOrigin
           ? current
-          : { ...current, [activeThread.id]: nextStartFromOrigin },
+          : { ...current, [activeThreadId]: nextStartFromOrigin },
       );
       return;
     }
```
