docs: add default links and Ask AI to search dialog#2703
docs: add default links and Ask AI to search dialog#2703Sushmithamallesh merged 4 commits intonextfrom
Conversation
Custom search dialog shows quick-access links (Quickstart, Authentication, Configuring Sessions, General FAQs, Troubleshooting) with subtitles when search is empty. Titles and descriptions are derived from MDX page frontmatter at build time. Adds "Ask AI" button inside dialog content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
The Please review and fix the vulnerabilities. You can try running: pnpm audit --fix --prodAudit output |
|
Claude finished @Sushmithamallesh's task in 2m 34s —— View job PR Review
SummaryThis PR adds a custom search dialog with default quick-access links and an "Ask AI" button connecting to the Decimal widget. The implementation is largely solid, but there are two issues worth fixing before merge. Issues1. Incorrect import path in
// Current (incorrect)
import { useSearchContext } from '@fumadocs/ui/contexts/search';
import { useI18n } from '@fumadocs/ui/contexts/i18n';Every other component in this PR uses the correct // Correct (matches custom-search-dialog.tsx and custom-schema-ui.tsx)
import { useSearchContext } from 'fumadocs-ui/contexts/search';
import { useI18n } from 'fumadocs-ui/contexts/i18n';
2. Module-level
let widgetOpen = false;
export function toggleDecimalWidget() {
// ...
widgetOpen ? decimal.hide() : decimal.show();
widgetOpen = !widgetOpen;
}If a user dismisses the Decimal widget using the widget's own close button (not through This is a UX bug but not a blocker — it affects users who close the widget via the widget's own UI. One mitigation: check whether the Decimal API exposes an What Looks Good
|
|
Claude finished @Sushmithamallesh's task in 2m 58s —— View job PR Review
The approach is sound — custom Issue 1: File: // Before
<SearchDialogList items={query.data === 'empty' ? null : query.data} />
// After
<SearchDialogList items={isEmpty ? null : query.data} />Issue 2: A more explicit alternative is to wrap the dialog: // Instead of passing defaultLinks through options with a type cast:
const CustomSearchDialogWithLinks = (props: SharedProps) => (
<CustomSearchDialog defaultLinks={defaultLinks} {...props} />
);
// Then in layout:
search={{
SearchDialog: CustomSearchDialogWithLinks,
options: { api: '/api/search' }, // ← also restore the api option here
}}Note that the Everything else looks good: all 5 linked pages have |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| api: '/api/search', | ||
| }, | ||
| defaultLinks, | ||
| } as Record<string, unknown>, |
There was a problem hiding this comment.
Default links never reach custom search dialog component
High Severity
defaultLinks is passed via search.options in the RootProvider, but Fumadocs' options field configures the search client (API endpoint, tags, etc.) — it does not forward those properties as props to the custom SearchDialog component. Fumadocs only passes SharedProps (open, onOpenChange) to custom dialog components. The as Record<string, unknown> cast masks the type error. As a result, CustomSearchDialog always receives defaultLinks as [] (its default), the defaultLinks.length > 0 condition is always false, and the quick-access links never render — breaking the primary feature of this PR.
Additional Locations (1)
- Restore api: '/api/search' in search options (single source of truth) - CustomSearchDialog accepts api prop from options spread - Remove unused isEmpty variable (TS can't narrow through intermediates) - Keep options spread approach (verified: SearchProvider line 52 does ...options) - Type cast needed because RootProvider types options more narrowly than SearchProvider actually consumes them Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @Sushmithamallesh's task in 2m 45s —— View job PR Review
SummaryThis PR adds a custom search dialog with default quick-access links and an "Ask AI" button. The latest commit ( One Issue to Verify
search={{
SearchDialog: CustomSearchDialog,
options: {
api: '/api/search',
defaultLinks,
} as Record<string, unknown>,
}}The commit message says this was verified against Verify in the Vercel preview: Open the search dialog (Cmd+K) — if 5 default links appear before typing anything, the options spread is working. If the dialog is empty until you type, the fix is to use a wrapper component: // In layout.tsx, replace:
SearchDialog: CustomSearchDialog,
options: { api: '/api/search', defaultLinks } as Record<string, unknown>,
// With:
SearchDialog: (props: SharedProps) => (
<CustomSearchDialog defaultLinks={defaultLinks} api="/api/search" {...props} />
),
options: undefined,This approach is type-safe and doesn't rely on internal Fumadocs behavior. What Looks Good
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @Sushmithamallesh's task in 1m 34s —— View job PR Review
One issue to fix before merge
In search={{
SearchDialog: CustomSearchDialog,
options: {
api: '/api/search',
defaultLinks, // ← this goes to the Fumadocs search client config
} as Record<string, unknown>,
}}Fumadocs only passes Fix: wrap the dialog to inject // docs/app/layout.tsx — add this after the defaultLinks computation, before the Layout function
import type { SharedProps } from 'fumadocs-ui/components/dialog/search';
const CustomSearchDialogWithLinks = (props: SharedProps) => (
<CustomSearchDialog defaultLinks={defaultLinks} {...props} />
);
// Then in RootProvider:
search={{
SearchDialog: CustomSearchDialogWithLinks,
options: { api: '/api/search' },
}}Everything else looks good: the |
Re:
|


Summary
source.getPage(), so they stay in sync automaticallyTest plan
bun run buildpasses with no type errors🤖 Generated with Claude Code