adds linting, fix linter errors, abort automatic scrolling

This commit is contained in:
Daniel Avila 2023-02-21 21:31:36 -05:00
parent 16932b37c0
commit a516b38e27
7 changed files with 4235 additions and 16569 deletions

View file

@ -19,7 +19,8 @@ export default function Conversation({
const [titleInput, setTitleInput] = useState(title);
const inputRef = useRef(null);
const dispatch = useDispatch();
const { trigger, isMutating } = manualSWR(`http://localhost:3050/messages/${id}`, 'get');
// const { trigger, isMutating } = manualSWR(`http://localhost:3050/messages/${id}`, 'get');
const { trigger } = manualSWR(`http://localhost:3050/messages/${id}`, 'get');
const rename = manualSWR(`http://localhost:3050/convos/update`, 'post');
const clickHandler = async () => {
@ -28,18 +29,16 @@ export default function Conversation({
}
if (bingData) {
const { title, conversationSignature, clientId, conversationId, invocationId } =
bingData;
const { conversationSignature, clientId, invocationId } = bingData;
dispatch(
setConversation({
title,
conversationSignature,
clientId,
conversationId,
invocationId,
error: false,
conversationId: id,
parentMessageId: null
parentMessageId: null,
conversationSignature,
clientId,
invocationId
})
);
} else {

View file

@ -8,7 +8,7 @@ import { setMessages } from '~/store/messageSlice';
export default function DeleteButton({ conversationId, renaming, cancelHandler }) {
const dispatch = useDispatch();
const { trigger, isMutating } = manualSWR(
const { trigger } = manualSWR(
'http://localhost:3050/convos/clear',
'post',
() => {

View file

@ -1,25 +1,13 @@
import React, { useState } from 'react';
import React from 'react';
import Conversation from './Conversation';
export default function Conversations({ conversations, conversationId }) {
// const currentRef = useRef(null);
// const scrollToTop = () => {
// currentRef.current?.scrollIntoView({ behavior: 'smooth' });
// };
// // this useEffect triggers the following warning in the Messages component (but not here):
// // Warning: Internal React error: Expected static flag was missing.
// useEffect(() => {
// scrollToTop();
// }, [conversationId]);
return (
<>
{/* <div ref={currentRef} /> */}
{conversations &&
conversations.length > 0 &&
conversations.map((convo, i) => {
conversations.map((convo) => {
const bingData = convo.conversationSignature
? {
conversationSignature: convo.conversationSignature,