fuma-nama/fumadocs

Search does not work correctlly on custom basePath

Closed this issue · 1 comments

To Reproduce

Hi, searh api does not work as expected if I update custoom basePath of application in next.config
It still trying to search on default api path http://localhost:3000/api/search?query=text

const config = {
  basePath:  "/help",   
  reactStrictMode: true,   
  output: "standalone",
};
export default withMDX(config);

Current vs. Expected behavior

Able to get search result if I try to request this url manually.
http://localhost:3000/help/api/search?query=text

Provide environment information

Operation System
   Platform: windows
Packages
  "fumadocs-core": "13.4.10", 
  "fumadocs-mdx": "10.0.2",
  "fumadocs-ui": "13.4.10",    
  "next": "^14.2.8",
  "react": "^18.3.1",

Which area(s) are affected? (Select all that apply)

Core

Additional context

No response

You have to update the search route from root provider, see docs for more info.

import { RootProvider } from 'fumadocs-ui/root-provider';
 
<RootProvider
  search={{
    options: {
      url: "/somewhere"
    },
  }}
>
  {children}
</RootProvider>;