Skip to content

fix(web): hide search without Orama data#894

Open
w3lld1 wants to merge 1 commit into
nodejs:mainfrom
w3lld1:fix/hide-search-without-orama
Open

fix(web): hide search without Orama data#894
w3lld1 wants to merge 1 commit into
nodejs:mainfrom
w3lld1:fix/hide-search-without-orama

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 11, 2026

Copy link
Copy Markdown

Description

Only render the web documentation search control when orama-db is one of the requested generator targets. This avoids showing a search UI that cannot return results when users generate only the web output.

The generator orchestration context now supplies the requested targets without making the web config source read the full run configuration. The web generator derives a build-time searchEnabled flag and supports an explicit web.showSearchBar override for deployments that provide search data separately. The navigation conditionally renders SearchBox, with regression coverage for both web-only and web + orama-db generation.

A patch changeset is included because this changes published web-generator behavior.

Validation

  • node --test --experimental-test-module-mocks src/generators/web/__tests__/generate.test.mjs (Node.js 24.18.0)
  • node --run test — 514 tests passed (Node.js 24.18.0)
  • node --run lint — no errors; 2 pre-existing warnings in useOrama.mjs
  • node --run format:check
  • git diff --check

Related Issues

Fixes #891

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@w3lld1 w3lld1 requested a review from a team as a code owner July 11, 2026 02:21
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jul 11, 2026 3:42am

Request Review

@cursor

cursor Bot commented Jul 11, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI gating and an optional config override; generator generate signatures gain a third argument but existing implementations ignore it.

Overview
Fixes a broken search UI when users generate only the web target by tying the navbar SearchBox to whether Orama search data is actually built.

The generator runner now passes { target } into every generator’s generate function. The web generator derives searchEnabled as showSearchBar when set, otherwise orama-db is in target, and threads that into #theme/config so NavBar renders search only when enabled. Docs add showSearchBar, plus a regression test for web-only vs web + orama-db. Patch changeset for published behavior.

Reviewed by Cursor Bugbot for commit c113a5c. Bugbot is set up for automated code reviews on this repo. Configure here.

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't read the full config from within the generator if it can be avoided

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think that's fine. If there's no data, why show the search? It could even help with debugging. I haven't looked through the changes yet, but in my opinion, that approach would be fine.

Signed-off-by: w3lld1 <42353747+w3lld1@users.noreply.github.com>
@w3lld1 w3lld1 force-pushed the fix/hide-search-without-orama branch from 3b26e77 to c113a5c Compare July 11, 2026 03:41
@w3lld1

w3lld1 commented Jul 11, 2026

Copy link
Copy Markdown
Author

Thanks for the review. I pushed a follow-up that avoids reading the full run config from the web config source: the orchestrator now passes requested targets through a small generator context. I also added the suggested web.showSearchBar override for shared/external search databases and documented it. The focused web tests, full 514-test suite, lint (no errors), formatting, and diff checks all pass on Node.js 24.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web generator should not render the search bar if orama-db is not enabled

3 participants