Commit Graph
58 Commits
Author SHA1 Message Date
Miranda Limonczenko f59c795eb5 feat(docs): render Option 1 on the server when the variant is forced (#52735)
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)
2026-11-06 19:46:37 +00:00
Anthony Lio 2182a9100f fix(docs): nav first paint (#52679)
## Problem

- the docs nav experiment from #52191 hides the top bar links and the
sidebar nav until the feature flags load
- the flags load after auth, posthog and configcat, so each visitor
waits up to 1s after hydration

## Solution

- changes the docs nav to show the server links on first paint, so most
visitors do not wait for the flags
- adds a cache of the experiment value from the last visit, so a
returning visitor gets their variant at hydration
- adds a head script that hides the nav only for visitors cached on
option-1, so the control menu does not flash
- fixes the nav swap when the posthog request fails, because the nav
keeps the cached variant
- fixes the stale option-1 cache after the flag is deleted, because the
cache saves `false` when posthog returns no flag
- changes the experiment exposure to wait for loaded flags, so a stale
cached variant is never recorded

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/docs/guides/auth](https://docs-git-antlio-fix-docs-nav-first-paint-supabase.vercel.app/docs/guides/auth)
on desktop and reload the page
2. make sure that the top bar links and the sidebar nav show on first
paint
3. open
[/docs/guides/auth?docs-ia-mvp-v1=option-1](https://docs-git-antlio-fix-docs-nav-first-paint-supabase.vercel.app/docs/guides/auth?docs-ia-mvp-v1=option-1)
and make sure that the top bar shows "Develop and deploy" and "Run and
manage"
4. at a mobile width, open the menu and make sure that the menu sections
show
5. run `pnpm --filter docs exec vitest run features/IaNav` and make sure
that all 18 tests pass

## 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)
2026-11-04 07:45:33 +00:00
Miranda Limonczenko 4b7af187a4 feat(docs): add Option 1 navigation behind the flag (#52191)
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.
2026-10-28 16:03:11 +00:00
Miranda Limonczenko 447cfa5227 feat(docs): add docs-ia-mvp-v1 flag for the new navigation (#52049)
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.
2026-10-27 15:00:59 -07:00
Gildas GarciaandIvan Vasilov 7f4b02f2a7 chore: update radix (#45111)
## 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>
2026-04-27 11:03:28 +02:00
Devanshu SharmaandAlan Daniel 36a4a774f7 refactor(docs): enhance the docs sidebar UI (#38869)
* 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>
2025-10-16 10:04:07 -04:00
Greg Richardson 52cb7f82b2 Docs: MCP with AI tools (#33610)
* docs: mcp

* fix: change admonition type to note

* chore: add 'npx' to dictionary

* feat: adds windsurf example

* fix: adds codium to dictionary
2025-02-18 21:07:02 +00:00
CharisandFrancesco Sansalvadore 2fb8b9f74c feat(docs): ai prompts section (#30342)
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
2024-11-26 13:43:04 -05:00
Charis 41d924b074 feat: new docs ia (#29364)
New Docs IA, mainly splitting up the miscellaneous bucket that is Platform into multiple sections
2024-10-09 12:38:34 -04:00
Francesco Sansalvadore 084294fe79 feat: docs breadcrumbs (#27929)
docs guides breadcrumbs
2024-07-15 10:25:13 +02:00
Charis ac192a5024 refactor(docs): migrate home page to app router (#27221) 2024-06-24 18:47:53 -04:00
Charis fa8c9f360b fix: docs sidebar collapse and highlight (#22108)
* fix: make sidebar collapse work when hash is selected

* fix: persist sidebar highlight when hash is selected

* chore: cleanup

* fix: fix enterprise sso case
2024-03-25 10:31:00 -04:00
Greg Richardson 4f9c7da788 chore: remove unused active prop on nav menus 2023-05-08 22:46:46 -06:00
Greg Richardson bc6dc86dab fix: prevent prefetch of hidden page links 2023-05-04 16:32:01 -06:00
pratikt 75b951ce86 docs: Visual bug on sidemenu #13421 2023-04-04 19:02:45 +05:30
Jonathan Summers-Muir 1b755c9713 move guides and fix accordion issue 2023-03-23 12:26:11 +08:00
Jonathan Summers-Muir 1aaa365670 init prop to force no collapse on docs side menu 2023-03-22 12:54:14 +08:00
Jonathan Summers-Muir 33f1c83710 Update NavigationMenuGuideList.tsx 2023-02-21 14:23:10 +08:00
Isaiah Hamilton 9e7623eb17 fix: docs sidebar 2023-02-20 23:11:05 -05:00
Terry Sutton f2a9aec58a Add Postgres Resources section to menu 2023-01-25 17:16:56 -03:30
Jonathan Summers-Muir c6cd65991d memo some components 2022-12-20 15:28:22 +08:00
Jonathan Summers-Muir 9bad9a7f0e more optimizing 2022-12-15 01:13:32 +08:00
Jonathan Summers-Muir 948132c406 do same with red docs 2022-12-14 01:47:41 +08:00
Jonathan Summers-Muir 6bc027997d start using react.memo to stop re-renders 2022-12-14 01:39:57 +08:00
Terry Sutton 79ae510d6f Fix self-hosting reference icons in menu items 2022-12-13 11:10:13 -03:30
Terry Sutton f146b0a371 Merge pull request #10912 from Hallidayo/docs-get-image-errors
docs: changed url paths
2022-12-13 10:42:34 -03:30
Ollie Halliday 0fd6dbc324 changed url paths 2022-12-13 13:51:17 +00:00
Jonathan Summers-Muir 2232dd1331 try more 2022-12-13 04:06:47 +08:00
Jonathan Summers-Muir a0afbdab3b moved state 2022-12-13 03:42:39 +08:00
Jonathan Summers-Muir a8811a49f4 use shallow links 2022-12-13 03:35:37 +08:00
Jonathan Summers-Muir 9f4187806b fixing mobile menu 2022-12-12 20:08:44 +08:00
Jonathan Summers-Muir 425f1992c7 fixed sidebar scrolling issues 2022-12-12 19:18:10 +08:00
Jonathan Summers-Muir 2ad16dcbc5 fix formatting on old docs 2022-12-12 17:59:26 +08:00
Jonathan Summers-Muir 64238c3ae7 moved a lot of docs around 2022-12-12 17:37:56 +08:00
Jonathan Summers-Muir a296f94d3f fixes to height issues of guide nav 2022-12-12 13:59:43 +08:00
Jonathan Summers-Muir 3e66153f5a more fixes 2022-12-11 14:48:12 +08:00
Terry Sutton 600ae9d9db Remove unneeded slashes before url path 2022-12-07 15:55:31 -03:30
Terry Sutton a069fab32b Add preamble files to top of ref 2022-12-06 09:55:05 -03:30
Jonathan Summers-Muir d2ca13e03e lots of homepage stuff 2022-12-06 16:28:00 +08:00
Terry Sutton d3bd00b4ca Fix light-dark icons in nav 2022-12-05 21:02:15 -03:30
Terry Sutton fef9f8e8d8 Fix unique key warnings 2022-12-05 10:14:45 -03:30
Jonathan Summers-Muir 756b932eb7 added passwordless page 2022-12-05 17:53:08 +08:00
Jonathan Summers-Muir b84cfa64c8 Added sub menus to sidebar 2022-12-05 13:37:59 +08:00
Terry Sutton 547acaf56d Add middleware to redirect bots to a single-file slug 2022-12-02 16:28:36 -03:30
Jonathan Summers-Muir b351649307 mobile menu changes 2022-11-28 14:53:42 +08:00
Terry Sutton 65f2feb59e Start mocking storage api spec 2022-11-24 15:58:22 -03:30
Terry Sutton 1584a831e0 Add cli config parsing 2022-11-24 14:06:05 -03:30
Jonathan Summers-Muir 74bbfd0f97 fix active states on side menu 2022-11-24 17:00:39 +08:00
Jonathan Summers-Muir a9df0d9f73 fix la menu 2022-11-21 21:00:21 +08:00
Jonathan Summers-Muir 8d5f05aa84 more nav fixes 2022-11-21 20:25:28 +08:00