fix(app): retain Explorer tab state

This commit is contained in:
Mohamed Boudra
2026-08-17 21:15:16 +02:00
parent b97993f866
commit a54b6c2020
3 changed files with 89 additions and 32 deletions
@@ -1,5 +1,12 @@
export const DEFAULT_IOS_KEYBOARD_INSET_MIN_HEIGHT = 120;
export function shouldUseCompactExplorerKeyboardPadding(input: {
isGit: boolean;
explorerTab: "changes" | "files" | "pr";
}): boolean {
return !input.isGit || input.explorerTab !== "changes";
}
export function resolveKeyboardShift(input: {
rawKeyboardHeight: number;
keyboardProgress: number;
@@ -1,5 +1,8 @@
import { describe, expect, it } from "vitest";
import { resolveKeyboardShift } from "./keyboard-shift-policy";
import {
resolveKeyboardShift,
shouldUseCompactExplorerKeyboardPadding,
} from "./keyboard-shift-policy";
describe("resolveKeyboardShift", () => {
it("keeps the existing open-keyboard offset behavior", () => {
@@ -38,3 +41,17 @@ describe("resolveKeyboardShift", () => {
).toBe(0);
});
});
describe("shouldUseCompactExplorerKeyboardPadding", () => {
it("keeps the changes viewport stable while preserving padding for other tabs", () => {
expect(shouldUseCompactExplorerKeyboardPadding({ isGit: true, explorerTab: "changes" })).toBe(
false,
);
expect(shouldUseCompactExplorerKeyboardPadding({ isGit: true, explorerTab: "files" })).toBe(
true,
);
expect(shouldUseCompactExplorerKeyboardPadding({ isGit: false, explorerTab: "changes" })).toBe(
true,
);
});
});