-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Named export DocSearch not found" error in Remix framework #2259
Comments
Hello, @pawelgalazka sorry for the delayed response. Did you resolve this? I don't know off the top of my head so wondering if you managed to figure it out before investing time on it. |
@randombeeper I did manage to resolve this, however my solution is more of a workaround:
import { Suspense, lazy, useEffect, useState } from "react"
import type { DocSearchProps } from "@docsearch/react"
import "@docsearch/css"
let hydrating = true
export function useHydrated() {
const [hydrated, setHydrated] = useState(() => !hydrating)
useEffect(() => {
hydrating = false
setHydrated(true)
}, [])
return hydrated
}
const OriginalDocSearch = lazy(() =>
import("@docsearch/react").then((module) => ({
default: module.DocSearch,
})),
)
export function DocSearch(docSearchProps: DocSearchProps) {
const hydrated = useHydrated()
if (!hydrated) {
return <div className="h-9" />
}
return (
<Suspense fallback={<div className="h-9" />}>
<div className="-ml-4 flex flex-col">
<OriginalDocSearch {...docSearchProps} />
</div>
</Suspense>
)
} which excludes Ideally I would expect to import and use original |
Description
When importing
DocSearch
React component in Remix framework web app, following error is thrown when running application:Steps to reproduce
npx create-remix@latest
DocSearch
import toapp/routes/_index.tsx
:npm run dev
http://localhost:5173/
Expected behavior
Error:
should not be produced when running web app in Remix framework. Instead DocSearch search component should be rendered.
Environment
The text was updated successfully, but these errors were encountered: