fix(dashboard): lazy-init useMobileKeyboard so remount has no stale render
When ChatView remounted (e.g. tab switch with keyboard still up), the hook started with keyboardOpen=false and corrected itself only after the effect ran. That single stale-state render briefly unhid the executor status bar, which appeared as a blank pane covering half the input box before the next state update settled it. useState initializers now call getKeyboardMetrics() lazily on first render so the very first paint already reflects the live keyboard state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -993,6 +993,36 @@ describe("createFnAgent", () => {
|
||||
}));
|
||||
});
|
||||
|
||||
it("continues session creation when setting thinking level hits reasoning conflict", async () => {
|
||||
const { piLog } = await import("../logger.js");
|
||||
const warnSpy = vi.spyOn(piLog, "warn").mockImplementation(() => {});
|
||||
const setThinkingLevel = vi.fn(() => {
|
||||
throw new Error("400 cannot specify both 'thinking' and 'reasoning_effort'");
|
||||
});
|
||||
|
||||
createAgentSessionMock.mockResolvedValueOnce({
|
||||
session: {
|
||||
prompt: vi.fn(),
|
||||
subscribe: vi.fn(),
|
||||
dispose: vi.fn(),
|
||||
setThinkingLevel,
|
||||
},
|
||||
});
|
||||
|
||||
const { createFnAgent } = await import("../pi.js");
|
||||
|
||||
await expect(createFnAgent({
|
||||
cwd: "/tmp",
|
||||
systemPrompt: "test",
|
||||
tools: "readonly",
|
||||
defaultThinkingLevel: "high",
|
||||
})).resolves.toBeTruthy();
|
||||
|
||||
expect(setThinkingLevel).toHaveBeenCalledWith("high");
|
||||
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("Disabling explicit thinking level"));
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
|
||||
describe("skill selection", () => {
|
||||
beforeEach(() => {
|
||||
// Reset modules to ensure fresh imports for each test
|
||||
|
||||
Reference in New Issue
Block a user