diff --git a/sidebars.ts b/sidebars.ts index 964e5ae3..3535c570 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -450,15 +450,9 @@ const baseSidebars: SidebarsConfig = { }, { type: 'category' as const, - // Original label when `platform-api` is off/unset; renamed to - // 'API Overview' when the flag is enabled (since the guides become - // shared across Client + Platform APIs). - label: 'Client API', + label: 'API Overview', collapsible: false, collapsed: false, - customProps: { - flagLabel: { flag: 'platform-api', label: 'API Overview' }, - }, items: [ { type: 'category', @@ -514,12 +508,6 @@ const baseSidebars: SidebarsConfig = { label: 'Platform API Reference', collapsible: false, collapsed: false, - // Gated behind the `platform-api` feature flag: when the flag is false or - // unset the section is omitted (original sidebar); when enabled (Edge - // Config or `?ff_platform-api=true`) it renders. - customProps: { - flag: 'platform-api', - }, items: [ { type: 'category', diff --git a/src/theme/DocSidebarItem/Category/index.tsx b/src/theme/DocSidebarItem/Category/index.tsx index 966f24d1..3fed27a9 100644 --- a/src/theme/DocSidebarItem/Category/index.tsx +++ b/src/theme/DocSidebarItem/Category/index.tsx @@ -157,26 +157,13 @@ export default function DocSidebarItemCategory({ } }, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]); - // Feature-flag gating: hide a category (and its children) when it declares a - // `customProps.flag` that isn't enabled. Evaluated at the end so all hooks - // above always run in a stable order (see rules of hooks). Enable via Edge - // Config or the runtime query param, e.g. `?ff_platform-api=true`. + // Feature-flag gating is evaluated after all hooks to preserve hook order. const { isEnabled } = React.useContext(FeatureFlagsContext); const flag = (item as any).customProps?.flag as string | undefined; if (flag && !isEnabled(flag)) { return null; } - // Feature-flag-aware label: when a category declares `customProps.flagLabel` - // ({ flag, label }) and that flag is enabled, render the alternate label - // instead of the default. Lets the same static config show the original - // label when the flag is off and a new label when it's on. - const flagLabel = (item as any).customProps?.flagLabel as - | { flag: string; label: string } - | undefined; - const label = - flagLabel && isEnabled(flagLabel.flag) ? flagLabel.label : item.label; - return (
)} - {label} + {item.label} {href && collapsible && (