Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: refresh collapsible measurement when content mode changes (#4170)

[._.]/ Adam Eivy660539960d68
diff --git a/client/src/components/ui/CollapsibleText.jsx b/client/src/components/ui/CollapsibleText.jsx
index 89430964de..dff8e4079d 100644
--- a/client/src/components/ui/CollapsibleText.jsx
+++ b/client/src/components/ui/CollapsibleText.jsx
@@ -84,6 +84,7 @@ export default function CollapsibleText({
const [isOverflowing, setIsOverflowing] = useState(false);
const ref = useRef(null);
const innerRef = useRef(null);
+ const hasChildren = children != null && children !== false;
useEffect(() => {
if (expanded) return;
@@ -96,11 +97,9 @@ export default function CollapsibleText({
observer.observe(el);
if (innerRef.current) observer.observe(innerRef.current);
return () => observer.disconnect();
- }, [text, expanded]);
+ }, [text, hasChildren, expanded]);
const clamp = CLAMP_CLASS[lines] || CLAMP_CLASS[2];
- const hasChildren = children != null && children !== false;
-
const renderContent = () => {
if (hasChildren) {
return (
diff --git a/client/src/components/ui/CollapsibleText.test.jsx b/client/src/components/ui/CollapsibleText.test.jsx
index 055a171007..242287b5ab 100644
--- a/client/src/components/ui/CollapsibleText.test.jsx
+++ b/client/src/components/ui/CollapsibleText.test.jsx
@@ -7,7 +7,10 @@ import CollapsibleText from './CollapsibleText';
const forceOverflow = () =>
vi.spyOn(HTMLElement.prototype, 'scrollHeight', 'get').mockReturnValue(500);
-afterEach(() => vi.restoreAllMocks());
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
describe('CollapsibleText', () => {
it('clamps overflowing text and toggles the clamp on expand', () => {