Raw
1 "use client"
2
3 import React from "react"
4 import { useInstantSearch } from "react-instantsearch"
5
6 export type SearchEmptyQueryBoundaryProps = {
7 children: React.ReactNode
8 fallback: React.ReactNode
9 }
10
11 export const SearchEmptyQueryBoundary = ({
12 children,
13 fallback,
14 }: SearchEmptyQueryBoundaryProps) => {
15 const { indexUiState } = useInstantSearch()
16
17 if (!indexUiState.query) {
18 return <>{fallback}</>
19 }
20
21 return <>{children}</>
22 }