fix(ui): prevent flicker by constraining content height

Resolves flicker and UI instability by dynamically calculating the available vertical space for the main content area.

A ResizeObserver is used to measure the height of the composer/input area. This height is subtracted from the total terminal height, and the result is used to set a  on the  component via .

This ensures the total UI height never exceeds the terminal viewport, preventing overflow and eliminating the root cause of the flicker during re-renders.
This commit is contained in:
Spencer
2026-01-16 20:09:25 +00:00
parent 53f54436c9
commit 5085e6ecc8
6 changed files with 92 additions and 25 deletions

View File

@@ -4,6 +4,24 @@
* SPDX-License-Identifier: Apache-2.0
*/
// Mock the ResizeObserver API for tests.
// This needs to be at the top of the file to ensure it's available globally
// before any other modules (especially React components) are imported.
// Otherwise, we can get a "ResizeObserver is not defined" error during test runs.
class ResizeObserver {
observe() {
// do nothing
}
unobserve() {
// do nothing
}
disconnect() {
// do nothing
}
}
global.ResizeObserver = ResizeObserver;
import { vi, beforeEach, afterEach } from 'vitest';
import { format } from 'node:util';