Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(transcript): exclude disclosure title toggle from reading hold

soulet9b4ea27d6ceb
diff --git a/apps/desktop/src/features/chat/transcript/disclosure.tsx b/apps/desktop/src/features/chat/transcript/disclosure.tsx
index 4b26a9a05..6797e47bc 100644
--- a/apps/desktop/src/features/chat/transcript/disclosure.tsx
+++ b/apps/desktop/src/features/chat/transcript/disclosure.tsx
@@ -144,11 +144,11 @@ export function useAutomaticDisclosure(
currentOpen.current = open;
const ownsReading = useCallback(
- () => ownsReadingPosition(titleRef.current, bodyRef.current),
+ () => ownsReadingPosition(bodyRef.current),
[],
);
const syncReading = useCallback(
- () => setReading(ownsReadingPosition(titleRef.current, bodyRef.current)),
+ () => setReading(ownsReadingPosition(bodyRef.current)),
[],
);
diff --git a/apps/desktop/test/transcript-disclosure-reading.test.mjs b/apps/desktop/test/transcript-disclosure-reading.test.mjs
index 3d4e2fafa..aabeaf524 100644
--- a/apps/desktop/test/transcript-disclosure-reading.test.mjs
+++ b/apps/desktop/test/transcript-disclosure-reading.test.mjs
@@ -196,3 +196,16 @@ test("a nested owner holds its own position and passes the hold outward", () =>
// still in follow mode would drag the same title away.
assert.match(anchorControl, /outerNotifier\?\.\(title\);/);
});
+
+test("a level's reading protection is restricted to its body and excludes its title toggle", () => {
+ // Focus on the toggle header itself must not mark the level as 'reading'
+ // and force it open prematurely before click completes.
+ assert.match(
+ disclosure,
+ /const ownsReading = useCallback\(\s*\(\) => ownsReadingPosition\(bodyRef\.current\),\s*\[\],\s*\);/,
+ );
+ assert.match(
+ disclosure,
+ /const syncReading = useCallback\(\s*\(\) => setReading\(ownsReadingPosition\(bodyRef\.current\)\),\s*\[\],\s*\);/,
+ );
+});