Skip to content

fix(docs): respect basePath in static search index URL#152

Merged
pratyush618 merged 1 commit into
masterfrom
fix/docs-search-basepath
May 8, 2026
Merged

fix(docs): respect basePath in static search index URL#152
pratyush618 merged 1 commit into
masterfrom
fix/docs-search-basepath

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

Summary

Search on docs.byteveda.org/taskito returns no results — typing "workflows" doesn't even render the "No result" placeholder.

Root cause: the docs ship with DOCS_BASE_PATH=/taskito (CI in .github/workflows/docs.yml), but fumadocs' static Orama client hardcodes the index URL to /api/search and is unaware of Next's basePath. So the deployed site fetches https://docs.byteveda.org/api/search (404) instead of https://docs.byteveda.org/taskito/api/search (200, 5.6 MB index). The rejected promise is then cached forever in getDBCached, and the dialog stays at items === null (hidden — that's why no "No result" message either).

Fix: expose basePath to the client as NEXT_PUBLIC_DOCS_BASE_PATH and pass it to useDocsSearch via the documented from option:

useDocsSearch({
  type: "static",
  initOrama,
  locale,
  from: `${basePath}/api/search`,
});

Locally with pnpm dev (no basePath) from becomes /api/search and behavior is unchanged.

Test plan

  • pnpm types:check passes
  • pnpm lint passes
  • Local sanity: pnpm dev → search "workflows" → results show
  • Local with basePath: DOCS_BASE_PATH=/taskito pnpm build && pnpm start → open localhost:3000/taskito → search "workflows" → results show (this reproduces the prod bug without the fix)
  • After merge: https://docs.byteveda.org/taskito → search works

Fumadocs' static Orama client hardcodes /api/search and ignores Next's
basePath, so on the github.io/taskito deploy the fetch 404s, the rejected
promise is cached, and the dialog renders empty (no "no results" text).
Expose basePath as NEXT_PUBLIC_DOCS_BASE_PATH and pass it via from.
@github-actions github-actions Bot added the docs label May 8, 2026
@pratyush618 pratyush618 merged commit 4643731 into master May 8, 2026
14 checks passed
@pratyush618 pratyush618 deleted the fix/docs-search-basepath branch May 8, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant