Files
gitbook/packages
Brett Jephson 20f177b314 Honour an explicit select slug on a tab
Tab slugs were always derived from the title, so a rename retargeted the tab's
selection and broke every select button pointing at the old slug. The document
schema now carries an optional `slug` per tab; resolve it ahead of the title.

An absent slug still derives from the title, so published pages are unchanged and
same-named tabs across a site keep selecting together with no authoring. Untitled
tabs keep falling back to their stable id.

`resolveSelectSlug` is duplicated from doc-core in the gitbook-x repo alongside
`slugifySelectValue`, for the same reason: the editor preview and the published
page have to resolve a tab to the same slug. Its test mirrors the editor's.

`slug` is read structurally for now — it is in the document schema but reaches
these types only once a new @gitbook/api is published, at which point the cast in
Tabs.tsx can go.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 09:57:36 +01:00
..