Skip to content

Commit d46eef9

Browse files
author
Matheus Luís
committed
fix(docs): broken search not seeing the basePath when calling the api
1 parent 5aedd64 commit d46eef9

File tree

6 files changed

+876
-390
lines changed

6 files changed

+876
-390
lines changed

apps/docs/app/layout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import "./global.css";
2-
import { RootProvider } from "fumadocs-ui/provider";
2+
import { Provider } from "@/components/providers";
33
import { Inter } from "next/font/google";
44
import type { ReactNode } from "react";
5-
import type { Metadata } from 'next';
5+
import type { Metadata } from "next";
66

77
const inter = Inter({
88
subsets: ["latin"],
99
});
1010

1111
export const metadata: Metadata = {
12-
description: 'Pimega Annotator Documentation',
12+
description: "Pimega Annotator Documentation",
1313
title: {
14-
template: '%s | pianno',
15-
default: 'pianno',
14+
template: "%s | pianno",
15+
default: "pianno",
1616
},
1717
};
1818

1919
export default function Layout({ children }: { children: ReactNode }) {
2020
return (
2121
<html lang="en" className={inter.className}>
2222
<body>
23-
<RootProvider>{children}</RootProvider>
23+
<Provider>{children}</Provider>
2424
</body>
2525
</html>
2626
);

apps/docs/components/providers.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"use client";
2+
3+
import { RootProvider } from "fumadocs-ui/provider";
4+
import type { ReactNode } from "react";
5+
import SearchDialog from "@/components/search";
6+
7+
export function Provider({ children }: { children: ReactNode }) {
8+
return (
9+
<RootProvider
10+
search={{
11+
SearchDialog,
12+
}}
13+
>
14+
{children}
15+
</RootProvider>
16+
);
17+
}

apps/docs/components/search.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use client";
2+
import SearchDialog from "fumadocs-ui/components/dialog/search-default";
3+
import type { SharedProps } from "fumadocs-ui/components/dialog/search";
4+
5+
export default function CustomSearchDialog(props: SharedProps) {
6+
// hardcoded api path in the search dialog does not sees next basePath
7+
return <SearchDialog api="/uwu/api/search" {...props} />;
8+
}

apps/docs/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"build": "next build",
7-
"clean": "rf -rf node_modules .turbo",
7+
"clean": "rm -rf .next node_modules .turbo",
88
"dev": "next dev -p 4321",
99
"start": "next start"
1010
},
@@ -14,11 +14,11 @@
1414
"@radix-ui/react-slot": "^1.0.2",
1515
"class-variance-authority": "^0.7.0",
1616
"clsx": "^2.1.0",
17-
"fumadocs-core": "8.1.1",
18-
"fumadocs-mdx": "8.0.2",
19-
"fumadocs-ui": "8.1.1",
17+
"fumadocs-core": "10.1.3",
18+
"fumadocs-mdx": "8.2.8",
19+
"fumadocs-ui": "10.1.3",
2020
"lucide-react": "^0.263.1",
21-
"next": "14.0.4",
21+
"next": "14.1.4",
2222
"react": "18.2.0",
2323
"react-dom": "18.2.0",
2424
"tailwind-merge": "^2.2.1",

apps/pianno/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"clean": "rm -rf .turbo node_modules",
6+
"clean": "rm -rf .next .turbo node_modules",
77
"dev": "next dev",
88
"build": "next build",
99
"start": "next start",

0 commit comments

Comments
 (0)