fix(docs): respect basePath in static search index URL#152
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Search on
docs.byteveda.org/taskitoreturns 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/searchand is unaware of Next'sbasePath. So the deployed site fetcheshttps://docs.byteveda.org/api/search(404) instead ofhttps://docs.byteveda.org/taskito/api/search(200, 5.6 MB index). The rejected promise is then cached forever ingetDBCached, and the dialog stays atitems === null(hidden — that's why no "No result" message either).Fix: expose
basePathto the client asNEXT_PUBLIC_DOCS_BASE_PATHand pass it touseDocsSearchvia the documentedfromoption:Locally with
pnpm dev(no basePath)frombecomes/api/searchand behavior is unchanged.Test plan
pnpm types:checkpassespnpm lintpassespnpm dev→ search "workflows" → results showDOCS_BASE_PATH=/taskito pnpm build && pnpm start→ openlocalhost:3000/taskito→ search "workflows" → results show (this reproduces the prod bug without the fix)https://docs.byteveda.org/taskito→ search works