From 6a7fbc6de1277a1f54c01a64c2183db2766f2564 Mon Sep 17 00:00:00 2001 From: Zheyuan Wu <60459821+Trance-0@users.noreply.github.com> Date: Fri, 7 Nov 2025 00:49:04 -0600 Subject: [PATCH] update dependencies and fix algolia search. --- app/layout.tsx | 2 +- components/docsearch.tsx | 20 ++++++++++++++++++-- package.json | 18 +++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 28041a8..e0b0340 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -83,7 +83,7 @@ export default async function RootLayout({ children }) { docsRepositoryBase="https://github.com/Trance-0/NoteNextra/tree/main" sidebar={{ defaultMenuCollapseLevel: 1 }} pageMap={pageMap} - // TODO: fix algolia search + // TODO: fix local search with distributed search index over containers search={} > {children} diff --git a/components/docsearch.tsx b/components/docsearch.tsx index 6fff87a..4dadb93 100644 --- a/components/docsearch.tsx +++ b/components/docsearch.tsx @@ -7,8 +7,8 @@ import {useTheme} from 'next-themes'; import '@docsearch/css'; function AlgoliaSearch () { - const {theme} = useTheme(); - const darkMode = theme === 'dark'; + const {theme, systemTheme} = useTheme(); + const darkMode = theme === 'dark' || (theme === 'system' && systemTheme === 'dark'); // console.log("darkMode", darkMode); return ( + // DocSearch lets you sanitize results before render. Filter out hits that don’t have a URL and give lvl0 a safe fallback. + items + .filter((i) => typeof i.url === 'string' && i.url) // drop records with null/empty url + .map((i) => ({ + ...i, + hierarchy: { + ...i.hierarchy, + // ensure strings for all places DocSearch prints text + lvl0: i.hierarchy?.lvl0 ?? i.hierarchy?.lvl1 ?? 'Documentation', + }, + })) + } + // END OF CODE GENERATED BY AI /> ); } diff --git a/package.json b/package.json index 6714dcb..bd64197 100644 --- a/package.json +++ b/package.json @@ -8,25 +8,25 @@ "start": "next start" }, "dependencies": { - "@docsearch/css": "^4.2.0", - "@docsearch/react": "^4.2.0", + "@docsearch/css": "^4.3.1", + "@docsearch/react": "^4.3.1", "@napi-rs/simple-git": "^0.1.22", - "@next/bundle-analyzer": "^15.3.5", + "@next/bundle-analyzer": "^16.0.1", "@vercel/analytics": "^1.5.0", "@vercel/speed-insights": "^1.2.0", - "cross-env": "^7.0.3", + "cross-env": "^10.1.0", "eslint-config-next": "^16.0.1", - "katex": "^0.16.22", + "katex": "^0.16.25", "next": "^16.0.1", "next-sitemap": "^4.2.3", - "nextra": "^4.2.17", - "nextra-theme-docs": "^4.2.17", + "nextra": "^4.6.0", + "nextra-theme-docs": "^4.6.0", "pagefind": "^1.4.0", "react": "^19.2.0", "react-dom": "^19.2.0" }, "devDependencies": { - "@types/node": "24.0.10", - "@types/react": "19.1.8" + "@types/node": "24.10.0", + "@types/react": "19.2.2" } }