Closes DOCS-1520
## Problem
The original PR was only client-side. This is adding server-side
integration.
The docs-nav evals fetch each page's HTML with no JavaScript and add
`?docs-ia-mvp-v1=option-1` to every request. The option-1 arm gets the
control navigation anyway.
Guide pages are statically generated, so the server can't read the query
parameter. `useIaNavVariant` reads the override from the URL after the
page loads, so the fetched HTML always has today's nav, hidden with an
`invisible` class.
The top nav dropdowns have a second gap. Their panels mount on the
client, so their links are not in the server HTML for either variant.
Every eval case starts at `/docs`, where those links are the only way
into the Option 1 groups.
## Solution
- **Rewrite option-1 requests:** `proxy.ts` sends `/docs` and guide
pages with `?docs-ia-mvp-v1=option-1` to `/docs/ia/option-1/…`. Pages
there render on the first request and are then cached, so nothing is
added to the build. Requests without the parameter, and `.md` requests,
are not rewritten.
- **Read the variant from the route:** `IaNavRouteProvider`, in the root
layout, reads the variant from the layout segments. `useIaNavVariant`
returns it on the server and records no PostHog exposure for it.
`useIaNavReady` is ready at once, so the nav has no `invisible` class.
- **Strip the route prefix:** on the server, `usePathname` returns the
rewritten path. The nav components, breadcrumbs, and `AiTools` use
`useDocsPathname`, which strips the `/ia/option-1` prefix.
- **Breadcrumbs follow the variant:** they resolve from the visitor's
nav config, not always today's.
- **Top nav subheads in the HTML:** a `<noscript>` block next to the top
nav lists the dropdown links for the visitor's variant, inside an
`sr-only` nav. Browsers with JavaScript ignore it.
- **No index for the route:** direct visits to `/docs/ia/option-1/…` get
`noindex`. Canonical URLs point to the real guide.
**Not changed:**
- **Reference pages:** they keep today's nav, even with the parameter.
- **Config pages:** the five generated config pages under `self-hosting`
and `local-development/cli` are not in the markdown manifest, so they
keep today's nav too.
- **Links:** they don't carry the query parameter, so a click in the
browser leaves the forced variant. This was already the case before this
PR.
- **Conflicts with #52679:** it changes the same hooks. Whichever PR
merges second needs a rebase.
## Review instructions
`grep -c` counts the lines of server HTML that contain the text. A count
of 1 or more means the text is in the HTML that an agent fetches without
JavaScript. A count of 0 means it is not.
1. Run `curl -s
"https://docs-git-docs-ia-option-1-server-render-supabase.vercel.app/docs/guides/auth/sessions?docs-ia-mvp-v1=option-1"
| grep -c "Run and manage"`. The count is 1 or more. "Run and manage" is
an Option 1 top nav label, so this checks that the parameter gets Option
1's nav from the server.
2. Run `curl -s
"https://docs-git-docs-ia-option-1-server-render-supabase.vercel.app/docs/guides/auth/sessions"
| grep -c "Run and manage"`. The count is 0. This checks that a request
without the parameter still gets today's nav.
3. Run `curl -s
"https://docs-git-docs-ia-option-1-server-render-supabase.vercel.app/docs?docs-ia-mvp-v1=option-1"
| grep -c "guides/platform/ssl-enforcement"`. The count is 1 or more.
The home page has no sidebar, and this link sits only in the "Run and
manage" dropdown, so this checks that the top nav subhead links are in
the server HTML.
4. Run `curl -s -o /dev/null -w "%{http_code}"
"https://docs-git-docs-ia-option-1-server-render-supabase.vercel.app/docs/guides/auth.md?docs-ia-mvp-v1=option-1"`.
It returns `200`. This checks that the markdown version still loads with
the parameter.
5. Open
[/docs/guides/auth](https://docs-git-docs-ia-option-1-server-render-supabase.vercel.app/docs/guides/auth)
in a browser and hover over the top nav. You see today's nav and
dropdowns.
## Checklist
Check all before review:
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
Closes DOCS-1469
## Problem
Option 1 in the navigation proposal groups the docs into Start, Build,
Develop and deploy, Run and manage, Self-Hosting, Reference, and
Resources. The `docs-ia-mvp-v1` flag from #52049 switches to an Option 1
config. That config is still a copy of today's navigation.
## Solution
- **Top nav:** reads Start, Build, Develop and deploy, Run and manage,
Self-Hosting, Reference, and Resources. Menus still open sidebars by URL
prefix, as they do today.
- **Run and manage:** pages under `/guides/platform`,
`/guides/security`, and `/guides/observability` share one sidebar with
the outline's seven groups.
- **Other sidebars:** follow the outline. REST, GraphQL and Realtime
share one sidebar, and Cron and Queues share one sidebar.
- **Seven new topics:** keep their outline labels and link to the
section on their source page, for example
`getting-started/api-keys#leaked-key`.
- **No flash of today's nav:** flags load in the browser, so the nav
stays invisible until the query param or the flags resolve, with a
1-second fallback. The links stay in the HTML for agents.
- **Tests:** each page appears once across the sidebars, and every link
goes to a page in today's navigation. With the flag off, `useNavItems`
returns today's navigation.
**Not changed:** no URLs move. Breadcrumbs still show today's trail,
which DOCS-1470 covers.
## Manual testing
1. Open [Database Backups with the flag
on](https://docs-git-docs-ia-nav-option-1-supabase.vercel.app/docs/guides/platform/backups?docs-ia-mvp-v1=option-1).
The top nav reads Start, Build, Develop and deploy, Run and manage,
Self-Hosting, Reference, and Resources. The sidebar shows the seven Run
and manage groups.
2. Open [the same page with the flag
off](https://docs-git-docs-ia-nav-option-1-supabase.vercel.app/docs/guides/platform/backups?docs-ia-mvp-v1=control).
Today's navigation shows.
3. Open [Database with the flag
on](https://docs-git-docs-ia-nav-option-1-supabase.vercel.app/docs/guides/database/overview?docs-ia-mvp-v1=option-1).
The sidebar starts with Connect to your database.
4. In the sidebar, open Row Level Security, roles and Vault, and select
Test RLS policies with pgTAP. The testing overview opens at Database
unit testing with pgTAP.
Closes DOCS-1464
## Problem
The new docs navigation, Option 1, needs an A/B test against today's
navigation. The docs app has no flag that switches the navigation per
visitor.
`docs:*` keys in this repo are build-time toggles from
`enabled-features`. They are the same for every visitor, so they can't
run an A/B. The flag is `docs-ia-mvp-v1`, a PostHog multivariate flag,
like `docs-search-v2`.
## Solution
- **Variant hook:** `useIaNavVariant` reads `docs-ia-mvp-v1` and returns
`control` or `option-1`. It copies `useSearchV2Variant`. It returns
`control` until the flag resolves, records exposure once resolved, and
respects consent.
- **Query param override:** `?docs-ia-mvp-v1=option-1` or
`?docs-ia-mvp-v1=control` forces a variant for dogfooding and evals. A
forced variant records no exposure.
- **Option 1 config:** `features/IaNav/option1.constants.ts` re-exports
today's navigation constants. An export defined in that file replaces
the re-exported one, so Option 1 in DOCS-1469 overrides only what
changes.
- **Consumers:** The top nav, the mobile menu, and the guide sidebar
read from `useNavItems`, which picks the config for the variant.
**Not changed:** Reference sidebars, breadcrumbs, and hub pages.
Breadcrumbs and hub pages can read `useIaNavVariant` in DOCS-1470 and
DOCS-1471.
**PostHog:** The flag doesn't exist in PostHog yet. Until it does, every
visitor gets `control`, and the query param still works.
## Manual testing
1. Open [Auth with Option 1
forced](https://docs-git-docs-ia-nav-flag-supabase.vercel.app/docs/guides/auth?docs-ia-mvp-v1=option-1).
The top nav and sidebar match today's navigation, because the Option 1
config is a copy. Locally, you can make a change to see the variant.
2. Open [Auth with no
param](https://docs-git-docs-ia-nav-flag-supabase.vercel.app/docs/guides/auth).
The navigation is unchanged.
## Problem
In order to update to react 19, we need to update several dependencies
## Solution
- migrate to the `radix` umbrella package to ease upgrade
- update some dependencies
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Consolidated Radix UI usage to a single unified package across apps
and packages, updated package manifests and workspace catalog entries.
No user-facing behavior, visuals, or public APIs changed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
* refactor(docs): enhance NavigationMenuGuideListItems component
* cleanup..
* Resolve formatting conflicts in NavigationMenuGuideListItems
* Came up with a crazy recursive approach...
* some changes.
* More cleanups...
* more cleanups....
* formatting the stuff
* refactor(navigation): remove sample menu data and optimize icon rendering in RecursiveNavigation
* cleanup...
* feat: enhance navigation with recursive dropdown indicators and performance optimizations
- Add visual chevron indicators for expandable sidebar items
- Implement recursive navigation system using existing NavMenuSection types
- Auto-expand accordion sections containing current active page on load/refresh
- Extract LinkContainer as independent component to prevent recreation on renders
- Fix React 19 compatibility issues with ref handling using useCallback pattern
- Resolve duplicate key warnings with improved key generation strategy
- Optimize accordion transition timing (500ms duration with ease-in-out) to prevent element overlap
- Preserve existing icon logic with hasLightIcon support for theme variants
- Maintain backward compatibility with existing navigation data structures
Performance improvements:
- Memoized recursive components to prevent unnecessary re-renders
- Stable component references for better React reconciliation
- Proper TypeScript interfaces with explicit prop definitions
UX improvements:
- Smooth accordion animations with physics-based easing
- Clear visual indicators for expandable menu items
- Automatic expansion of sections containing current page
- Professional-grade transition animations
Technical details:
- Uses existing NavMenuSection recursive type structure
- Implements containsActivePath helper for active page detection
- Leverages Radix UI accordion with proper data-state attributes
- Maintains all existing functionality including dynamic menu injection
* Cleanup...
* feat: implement cookie-based persisted state for navigation accordion
- Replace localStorage with cookie-based persistence for SSR compatibility
- Add proper cookie helpers with SameSite=Lax and 30-day expiration
- Implement initialization state to prevent hydration mismatches
- Maintain auto-expand functionality for active page sections
- Preserve user's manual accordion state across page refreshes and sessions
- Add debounced cookie updates (300ms) for performance optimization
- Use proper cookie naming convention: 'supabase-docs-nav-state'
Benefits:
- SSR compatible: Works with server-side rendering
- Cross-session persistence: Maintains state across browser sessions
- Better security: Cookies are more secure than localStorage
- Performance: Debounced updates prevent excessive cookie writes
- User experience: Seamless navigation state preservation
* refactor: implement individual item-based persistence following reference pattern
- Replace global state management with individual item persistence
- Use sessionStorage with 'nav-expansion-' prefix for each item
- Follow the exact pattern from reference: usePersistedExpansionState hook
- Maintain auto-expansion for active page sections
- Simplify state management by removing complex global state
- Each accordion item manages its own expansion state independently
- Preserve user's manual toggle state across page refreshes
- Use sessionStorage instead of cookies for better performance
Benefits:
- Cleaner architecture: Each item manages its own state
- Better performance: No global state updates
- Simpler logic: Direct item-to-storage mapping
- Reference pattern compliance: Follows established patterns
- Individual control: Each section can be toggled independently
- Session persistence: Maintains state during browser session
* refactor: implement URL-driven navigation state following Supabase docs pattern
- Replace sessionStorage persistence with URL-driven expansion state
- Follow the established Supabase docs pattern: URL as single source of truth
- Remove individual item persistence hooks in favor of pathname-based logic
- Implement useUrlDrivenExpansion hook that determines open sections from current URL
- Use getSectionsContainingPath to find all sections that should be expanded
- Remove manual toggle functionality - sections open/close based on URL navigation
- Maintain smooth transitions and visual indicators for expandable sections
- Ensure consistency and reliability by using URL as the definitive state source
Benefits:
- Reliability: URL is always the single source of truth
- Consistency: Matches existing Supabase docs navigation behavior
- Simplicity: No complex state management or storage concerns
- Performance: No localStorage/sessionStorage operations
- SSR Compatible: Works perfectly with server-side rendering
- Predictable: Navigation state is always consistent with current page
* persistant state.
* file delete
* cleanup..
* file cleanup
* cleanup...
* cleanup..
* formatting..
* aww shit that it.
---------
Co-authored-by: Alan Daniel <stylesshjs@gmail.com>
* fix: make sidebar collapse work when hash is selected
* fix: persist sidebar highlight when hash is selected
* chore: cleanup
* fix: fix enterprise sso case