Revert "fix(dashboard): lazy-init useMobileKeyboard so remount has no stale render"

This reverts commit eb111f526e.
This commit is contained in:
gsxdsm
2026-05-06 21:40:55 -07:00
parent eb111f526e
commit 6488110239
5 changed files with 60 additions and 181 deletions

View File

@@ -110,23 +110,10 @@ interface UseMobileKeyboardOptions {
export function useMobileKeyboard(
{ enabled = true }: UseMobileKeyboardOptions = {},
): { keyboardOverlap: number; viewportHeight: number | null; viewportOffsetTop: number; keyboardOpen: boolean } {
// Lazy initial values: read the actual visualViewport on first render
// so a remount (e.g. switching tabs back with the keyboard up) doesn't
// start with keyboardOpen=false. That stale-state render briefly hid
// the .chat-thread compensation and unhid the executor status bar,
// which then reappeared as a blank pane covering half the composer
// before settling.
const initialMetrics = (): KeyboardMetrics => {
if (!enabled || typeof window === "undefined" || !isMobileDevice()) {
return { overlap: 0, open: false, vvHeight: null, vvOffsetTop: 0 };
}
return getKeyboardMetrics();
};
const [initial] = useState(initialMetrics);
const [keyboardOverlap, setKeyboardOverlap] = useState(initial.overlap);
const [viewportHeight, setViewportHeight] = useState<number | null>(initial.vvHeight);
const [viewportOffsetTop, setViewportOffsetTop] = useState(initial.vvOffsetTop);
const [keyboardOpen, setKeyboardOpen] = useState(initial.open);
const [keyboardOverlap, setKeyboardOverlap] = useState(0);
const [viewportHeight, setViewportHeight] = useState<number | null>(null);
const [viewportOffsetTop, setViewportOffsetTop] = useState(0);
const [keyboardOpen, setKeyboardOpen] = useState(false);
useEffect(() => {
if (!enabled || !isMobileDevice()) {