chore: lint fix

fixed lint errors
This commit is contained in:
Dustin Loring 2025-01-18 13:09:54 -05:00 committed by GitHub
commit 0f4f859a43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import type { Message } from 'ai';
import React, { type RefCallback } from 'react';
import { ClientOnly } from 'remix-utils/client-only';
import styles from './BaseChat.module.scss';
import { ChatHistory } from './ChatHistory.client';
import FilePreview from './FilePreview';
import GitCloneButton from './GitCloneButton';
import { ImportFolderButton } from './ImportFolderButton';
@ -12,7 +13,6 @@ import { Menu } from '~/components/sidebar/Menu.client';
import { IconButton } from '~/components/ui/IconButton';
import { Workbench } from '~/components/workbench/Workbench.client';
import { classNames } from '~/utils/classNames';
import { ChatHistory } from './ChatHistory.client';
interface BaseChatProps {
textareaRef?: React.RefObject<HTMLTextAreaElement | null> | undefined;

View File

@ -1,9 +1,9 @@
import { useNavigate, useLoaderData } from '@remix-run/react';
import { useEffect, useState } from 'react';
import { IconButton } from '~/components/ui/IconButton';
import { getAll } from '~/lib/persistence/db';
import type { ChatHistoryItem } from '~/lib/persistence/useChatHistory';
import { db } from '~/lib/persistence/useChatHistory';
import { getAll } from '~/lib/persistence/db';
import { useNavigate, useLoaderData } from '@remix-run/react';
import { IconButton } from '~/components/ui/IconButton';
import { classNames } from '~/utils/classNames';
import { createScopedLogger } from '~/utils/logger';
@ -16,14 +16,17 @@ export function ChatHistory() {
const { id: currentId } = useLoaderData<{ id?: string }>();
useEffect(() => {
if (!db) return;
if (!db) {
return;
}
const loadHistory = async () => {
try {
const items = await getAll(db!);
// Filter items to only show history for the current chat
// filter items to only show history for the current chat
const filteredItems = items
.filter(item => item.urlId === currentId || item.id === currentId)
.filter((item) => item.urlId === currentId || item.id === currentId)
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
setHistory(filteredItems);
} catch (error) {
@ -39,7 +42,9 @@ export function ChatHistory() {
setIsOpen(false);
};
if (!db || history.length === 0) return null;
if (!db || history.length === 0) {
return null;
}
return (
<div className="relative">