Add Search tab to Docs Embed, refactor search into an embeddable frame#4185
Add Search tab to Docs Embed, refactor search into an embeddable frame#4185zenoachtig wants to merge 4 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 9d7d930 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bc204541a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/search/route.ts
Outdated
Show resolved
Hide resolved
6bc2045 to
183ba55
Compare
packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/search/route.ts
Outdated
Show resolved
Hide resolved
packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/search/route.ts
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,16 @@ | |||
| import type { RouteLayoutParams } from '@/app/utils'; | |||
There was a problem hiding this comment.
Why do we need a dynamic version of this page ?
There was a problem hiding this comment.
From Codex, please call its bluff because I don't know static vs dynamic well enough:
We need the dynamic page for route parity with the rest of the embed surface. Search is now a first-class embed tab, so it needs to exist in both the static and dynamic site trees, just like embed docs and embed assistant. It’s not additional behavior, just the dynamic route entry point using getEmbeddableDynamicContext().
packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/search/route.ts
Outdated
Show resolved
Hide resolved
|
@gitbook review |
|
@gitbook review and update the docs |
|
@gitbook-bot review and update docs |
This PR refactors search so it can be rendered as a reusable embeddable frame, while preserving the existing docs-site search experience.
On the docs site, search still uses the current model:
Inside the docs embed, search can now be mounted as a first-class
searchtab:The main goal here was structural. We wanted search to stop being tightly coupled to one popover presentation, so we can support other layouts later without reworking the search logic again.
What changed
Search is now organized around a shared frame/controller split:
SearchFrameowns the frame-level UIuseSearchControllerowns search behavior and derived search stateSearchContainerkeeps the existing docs-site input + popover compositionEmbeddableSearchrenders the same frame directly as an embed tabThis also adds
searchas an embed tab and includes it in the default embed tab set.Navigation and embed behavior
A large part of this work was simplifying how embedded navigation works.
The initial version introduced client-side search href rewriting to reinterpret site links inside the embed. That worked, but it pushed search-specific navigation logic into the render tree and expanded
LinkContextin a way that felt too foundational for a narrow use case.This PR aligns Search with AIChat instead:
asEmbeddableasEmbeddableThis keeps the client simpler and makes Search and AIChat consistent: both now treat embeddable mode as a server-side render/output option.