mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
chore: lint fix
fixed lint errors
This commit is contained in:
commit
0f4f859a43
@ -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;
|
||||
|
||||
@ -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">
|
||||
@ -78,4 +83,4 @@ export function ChatHistory() {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user