Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(web): keep AutoHeight's height updater pure

Ethan4c5f022a8aef
diff --git a/apps/web/src/components/ui/auto-height.tsx b/apps/web/src/components/ui/auto-height.tsx
index ffff703f..f8374128 100644
--- a/apps/web/src/components/ui/auto-height.tsx
+++ b/apps/web/src/components/ui/auto-height.tsx
@@ -30,12 +30,14 @@ export function AutoHeight({
useLayoutEffect(() => {
const element = inner.current;
if (!element || typeof ResizeObserver === "undefined") return;
- const measure = () =>
- setHeight((current) => {
- const next = element.offsetHeight;
- if (current !== undefined && current !== next) setMoving(true);
- return next;
- });
+ // The last measured height, so a change is detected outside the updater.
+ let measured: number | undefined = appear ? 0 : undefined;
+ const measure = () => {
+ const next = element.offsetHeight;
+ if (measured !== undefined && measured !== next) setMoving(true);
+ measured = next;
+ setHeight(next);
+ };
// Starting from zero, grow on the next frame so the change animates.
let frame = 0;
if (appear)