Skip to content

Commit

Permalink
Merge pull request #240 from yamada-ui/feat/223-search
Browse files Browse the repository at this point in the history
feat(search): add 404 display when search result is not found
  • Loading branch information
hirotomoyamada committed Jun 19, 2024
2 parents c086d5a + cba0d6e commit c5d6ab5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pages/search/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ParsedUrlQuery } from "querystring"
import { isArray } from "@yamada-ui/react"
import { isArray, isEmpty } from "@yamada-ui/react"
import type {
InferGetServerSidePropsType,
NextPageWithConfig,
Expand Down Expand Up @@ -45,6 +45,12 @@ export const getServerSideProps = async ({
)
).filter(Boolean) as Component[]

if (isEmpty(components)) {
return {
notFound: true,
}
}

const ui = getUI(locale as Locale)

return {
Expand Down

0 comments on commit c5d6ab5

Please sign in to comment.