Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(docs-search): clear results when performing new search

Greg Richardson658ca665c183
diff --git a/apps/docs/components/Clippy/ClippyModal.tsx b/apps/docs/components/Clippy/ClippyModal.tsx
index 22e5f90b915..662d2fcc689 100644
--- a/apps/docs/components/Clippy/ClippyModal.tsx
+++ b/apps/docs/components/Clippy/ClippyModal.tsx
@@ -74,8 +74,10 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
const handleSearchConfirm = useCallback(
async (query: string) => {
- setHasError(false)
+ setResults([])
setAnswer(undefined)
+ setIsResponding(false)
+ setHasError(false)
setIsLoading(true)
const { error, data: pageSections } = await supabaseClient.functions.invoke('search', {
@@ -99,8 +101,10 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
)
const handleClippyConfirm = useCallback(async (query: string) => {
- setHasError(false)
+ setResults([])
setAnswer(undefined)
+ setIsResponding(false)
+ setHasError(false)
setIsLoading(true)
const eventSource = new SSE(`${edgeFunctionUrl}/clippy-search`, {
@@ -153,6 +157,7 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
eventSourceRef.current?.close()
eventSourceRef.current = undefined
setQuery('')
+ setResults([])
setAnswer(undefined)
setIsResponding(false)
setHasError(false)