fix: biome formatting in Chat.test.tsx and ChatInput.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dave
2026-03-18 15:07:49 +00:00
parent 3923aafb71
commit dd83e0f4ee
2 changed files with 43 additions and 12 deletions

View File

@@ -631,7 +631,10 @@ describe("Chat localStorage persistence (Story 145)", () => {
// Verify sendChat was called with ALL prior messages + the new one // Verify sendChat was called with ALL prior messages + the new one
expect(lastSendChatArgs).not.toBeNull(); expect(lastSendChatArgs).not.toBeNull();
const args = lastSendChatArgs as unknown as { messages: Message[]; config: unknown }; const args = lastSendChatArgs as unknown as {
messages: Message[];
config: unknown;
};
expect(args.messages).toHaveLength(3); expect(args.messages).toHaveLength(3);
expect(args.messages[0]).toEqual({ expect(args.messages[0]).toEqual({
role: "user", role: "user",
@@ -1350,7 +1353,14 @@ describe("Bug 264: Claude Code session ID persisted across browser refresh", ()
expect(lastSendChatArgs).not.toBeNull(); expect(lastSendChatArgs).not.toBeNull();
expect( expect(
((lastSendChatArgs as unknown as { messages: Message[]; config: unknown })?.config as Record<string, unknown>).session_id, (
(
lastSendChatArgs as unknown as {
messages: Message[];
config: unknown;
}
)?.config as Record<string, unknown>
).session_id,
).toBe("persisted-session-xyz"); ).toBe("persisted-session-xyz");
}); });

View File

@@ -1,7 +1,14 @@
import * as React from "react"; import * as React from "react";
import { api } from "../api/client"; import { api } from "../api/client";
const { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } = React; const {
forwardRef,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} = React;
export interface ChatInputHandle { export interface ChatInputHandle {
appendToInput(text: string): void; appendToInput(text: string): void;
@@ -131,12 +138,15 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
}, []); }, []);
// Compute filtered files for current picker query // Compute filtered files for current picker query
const filteredFiles = pickerQuery !== null const filteredFiles =
? projectFiles pickerQuery !== null
.filter((f) => fuzzyMatch(f, pickerQuery)) ? projectFiles
.sort((a, b) => fuzzyScore(a, pickerQuery) - fuzzyScore(b, pickerQuery)) .filter((f) => fuzzyMatch(f, pickerQuery))
.slice(0, 10) .sort(
: []; (a, b) => fuzzyScore(a, pickerQuery) - fuzzyScore(b, pickerQuery),
)
.slice(0, 10)
: [];
const dismissPicker = useCallback(() => { const dismissPicker = useCallback(() => {
setPickerQuery(null); setPickerQuery(null);
@@ -177,7 +187,10 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
// Lazily load files on first trigger // Lazily load files on first trigger
if (projectFiles.length === 0) { if (projectFiles.length === 0) {
api.listProjectFiles().then(setProjectFiles).catch(() => {}); api
.listProjectFiles()
.then(setProjectFiles)
.catch(() => {});
} }
} else { } else {
if (pickerQuery !== null) dismissPicker(); if (pickerQuery !== null) dismissPicker();
@@ -191,7 +204,9 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
if (pickerQuery !== null && filteredFiles.length > 0) { if (pickerQuery !== null && filteredFiles.length > 0) {
if (e.key === "ArrowDown") { if (e.key === "ArrowDown") {
e.preventDefault(); e.preventDefault();
setPickerSelectedIndex((i) => Math.min(i + 1, filteredFiles.length - 1)); setPickerSelectedIndex((i) =>
Math.min(i + 1, filteredFiles.length - 1),
);
return; return;
} }
if (e.key === "ArrowUp") { if (e.key === "ArrowUp") {
@@ -220,7 +235,13 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
handleSubmit(); handleSubmit();
} }
}, },
[pickerQuery, filteredFiles, pickerSelectedIndex, selectFile, dismissPicker], [
pickerQuery,
filteredFiles,
pickerSelectedIndex,
selectFile,
dismissPicker,
],
); );
const handleSubmit = () => { const handleSubmit = () => {