Skip to content

Commit 268bdc3

Browse files
authored
Fixes search page with no query should not throw (#6547)
fix - search page with no query should not throw
1 parent 6dc48dc commit 268bdc3

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

components/MDX/SearchPage/index.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useTranslations } from 'next-intl';
66
import { useEffect, useState, type FC } from 'react';
77

88
import { WithPoweredBy } from '@/components/Common/Search/States/WithPoweredBy';
9+
import { WithSearchBox } from '@/components/Common/Search/States/WithSearchBox';
910
import { pathToBreadcrumbs } from '@/components/Common/Search/utils';
1011
import Link from '@/components/Link';
1112
import { useBottomScrollListener } from '@/hooks/react-client';
@@ -27,6 +28,7 @@ const SearchPage: FC = () => {
2728

2829
const searchTerm = searchParams?.get('q');
2930
const searchSection = searchParams?.get('section');
31+
const [shownSearchBox, setShownSearchbox] = useState<boolean>(!searchTerm);
3032

3133
useBottomScrollListener(() => setOffset(offset => offset + 10));
3234

@@ -78,6 +80,9 @@ const SearchPage: FC = () => {
7880

7981
return (
8082
<div className={styles.searchPageContainer}>
83+
{shownSearchBox ? (
84+
<WithSearchBox onClose={() => setShownSearchbox(false)} />
85+
) : null}
8186
<div className={styles.searchTermContainer}>
8287
<h1>
8388
{t('components.search.searchPage.title', { query: searchTerm })}

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@heroicons/react": "~2.1.1",
4141
"@mdx-js/mdx": "^3.0.1",
4242
"@nodevu/core": "~0.1.0",
43-
"@orama/highlight": "^0.1.3",
43+
"@orama/highlight": "^0.1.5",
4444
"@oramacloud/client": "^1.0.9",
4545
"@radix-ui/react-accessible-icon": "^1.0.3",
4646
"@radix-ui/react-avatar": "^1.0.4",

0 commit comments

Comments
 (0)