Skip to content

Commit

Permalink
Merge pull request #50 from kreneskyp/chat_artifact_updates
Browse files Browse the repository at this point in the history
Chat artifact list wasn't resetting when switching chats.
  • Loading branch information
kreneskyp committed May 24, 2023
2 parents d83fb0b + 7d47f68 commit 820bb73
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 820bb73

Please sign in to comment.