Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat artifact list wasn't resetting when switching chats. #50

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion frontend/chat/sidebar/SideBarArtifactList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from "react";
import React, { useCallback, useEffect, useState } from "react";
import { HStack, VStack, Heading, Box, Text } from "@chakra-ui/react";
import { useColorMode } from "@chakra-ui/color-mode";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
Expand Down Expand Up @@ -26,6 +26,11 @@ const SideBarArtifactList = ({ queryRef }) => {
const { chat } = usePreloadedQuery(ChatByIdQuery, queryRef);
const [artifacts, setArtifacts] = useState(chat.task.artifacts);

// Reset artifacts when chat.id changes
useEffect(() => {
setArtifacts(chat.task.artifacts);
}, [chat.id]);

const { colorMode } = useColorMode();

// Handle incoming new messages and update message groups
Expand Down