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:
@@ -631,7 +631,10 @@ describe("Chat localStorage persistence (Story 145)", () => {
|
||||
|
||||
// Verify sendChat was called with ALL prior messages + the new one
|
||||
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[0]).toEqual({
|
||||
role: "user",
|
||||
@@ -1350,7 +1353,14 @@ describe("Bug 264: Claude Code session ID persisted across browser refresh", ()
|
||||
|
||||
expect(lastSendChatArgs).not.toBeNull();
|
||||
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");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import * as React from "react";
|
||||
import { api } from "../api/client";
|
||||
|
||||
const { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } = React;
|
||||
const {
|
||||
forwardRef,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
useRef,
|
||||
useState,
|
||||
} = React;
|
||||
|
||||
export interface ChatInputHandle {
|
||||
appendToInput(text: string): void;
|
||||
@@ -131,10 +138,13 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
|
||||
}, []);
|
||||
|
||||
// Compute filtered files for current picker query
|
||||
const filteredFiles = pickerQuery !== null
|
||||
const filteredFiles =
|
||||
pickerQuery !== null
|
||||
? projectFiles
|
||||
.filter((f) => fuzzyMatch(f, pickerQuery))
|
||||
.sort((a, b) => fuzzyScore(a, pickerQuery) - fuzzyScore(b, pickerQuery))
|
||||
.sort(
|
||||
(a, b) => fuzzyScore(a, pickerQuery) - fuzzyScore(b, pickerQuery),
|
||||
)
|
||||
.slice(0, 10)
|
||||
: [];
|
||||
|
||||
@@ -177,7 +187,10 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
|
||||
|
||||
// Lazily load files on first trigger
|
||||
if (projectFiles.length === 0) {
|
||||
api.listProjectFiles().then(setProjectFiles).catch(() => {});
|
||||
api
|
||||
.listProjectFiles()
|
||||
.then(setProjectFiles)
|
||||
.catch(() => {});
|
||||
}
|
||||
} else {
|
||||
if (pickerQuery !== null) dismissPicker();
|
||||
@@ -191,7 +204,9 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
|
||||
if (pickerQuery !== null && filteredFiles.length > 0) {
|
||||
if (e.key === "ArrowDown") {
|
||||
e.preventDefault();
|
||||
setPickerSelectedIndex((i) => Math.min(i + 1, filteredFiles.length - 1));
|
||||
setPickerSelectedIndex((i) =>
|
||||
Math.min(i + 1, filteredFiles.length - 1),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (e.key === "ArrowUp") {
|
||||
@@ -220,7 +235,13 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
|
||||
handleSubmit();
|
||||
}
|
||||
},
|
||||
[pickerQuery, filteredFiles, pickerSelectedIndex, selectFile, dismissPicker],
|
||||
[
|
||||
pickerQuery,
|
||||
filteredFiles,
|
||||
pickerSelectedIndex,
|
||||
selectFile,
|
||||
dismissPicker,
|
||||
],
|
||||
);
|
||||
|
||||
const handleSubmit = () => {
|
||||
|
||||
Reference in New Issue
Block a user