From 4e14cfd966f29a74523ff66a2cea92a95bdd7b3a Mon Sep 17 00:00:00 2001 From: Jawad Laraqui Date: Wed, 22 May 2024 22:09:32 -0400 Subject: [PATCH] fix(assistantState): cache full state when reloading assistant (#39) - Add examples dependency to submit handler (last state loaded) - Center data-load spinner and wrap both UIs Co-authored-by: giancarlo tricerri --- .../src/pages/ExploreAssistantPage/index.tsx | 12 +++---- .../src/pages/ExploreBasePage/index.tsx | 35 +++++++++++++++++++ .../src/pages/ExploreChatPage/index.tsx | 11 ++---- 3 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 explore-assistant-extension/src/pages/ExploreBasePage/index.tsx diff --git a/explore-assistant-extension/src/pages/ExploreAssistantPage/index.tsx b/explore-assistant-extension/src/pages/ExploreAssistantPage/index.tsx index 9b0af37c..3afd8260 100644 --- a/explore-assistant-extension/src/pages/ExploreAssistantPage/index.tsx +++ b/explore-assistant-extension/src/pages/ExploreAssistantPage/index.tsx @@ -3,7 +3,6 @@ import { Button, FieldTextArea, Heading, - Layout, Paragraph, Section, Space, @@ -26,6 +25,7 @@ import SamplePrompts from '../../components/SamplePrompts' import PromptHistory from '../../components/PromptHistory' import { RootState } from '../../store' import useFetchData from '../../hooks/useSendVertexMessage' +import ExploreBasePage from '../ExploreBasePage/' const ExploreAssistantPage = () => { const dispatch = useDispatch() @@ -33,7 +33,7 @@ const ExploreAssistantPage = () => { const [textAreaValue, setTextAreaValue] = React.useState('') const { extensionSDK } = useContext(ExtensionContext) - const { exploreUrl, isQuerying, history } = useSelector( + const { exploreUrl, isQuerying, history, examples} = useSelector( (state: RootState) => state.assistant, ) @@ -80,7 +80,7 @@ const ExploreAssistantPage = () => { JSON.stringify(updatedHistory), ) }, - [history], + [history, examples], ) const handleSubmit = useCallback(async () => { @@ -97,8 +97,7 @@ const ExploreAssistantPage = () => { } return ( - <> - + - )} - + ) }