diff --git a/code/.storybook/manager.tsx b/code/.storybook/manager.tsx index f7a31bd2bd06..214e5d0e9375 100644 --- a/code/.storybook/manager.tsx +++ b/code/.storybook/manager.tsx @@ -1,8 +1,13 @@ -import { startCase } from 'es-toolkit/string'; import { addons } from 'storybook/manager-api'; -addons.setConfig({ - sidebar: { - renderLabel: ({ name, type }) => (type === 'story' ? name : startCase(name)), - }, -}); +addons.register('redirect-fix', () => { + const { pathname, search, hash } = window.location; + + if (pathname.endsWith('index.html')) { + + const newPathname = pathname.replace(/index\.html$/, ''); + const newUrl = newPathname + search + hash; + + window.location.replace(newUrl); + } +}); \ No newline at end of file diff --git a/code/core/src/manager/index.tsx b/code/core/src/manager/index.tsx index 9de62e5dd8e6..4ce6c55360b4 100644 --- a/code/core/src/manager/index.tsx +++ b/code/core/src/manager/index.tsx @@ -90,6 +90,13 @@ const Main: FC<{ provider: Provider }> = ({ provider }) => { }; export function renderStorybookUI(domNode: HTMLElement, provider: Provider) { + if (window.location.pathname.endsWith('index.html')) { + const { pathname, search, hash } = window.location; + const newPath = pathname.replace(/index\.html$/, ''); + window.location.replace(newPath + search + hash); + return; + } + if (!(provider instanceof Provider)) { throw new ProviderDoesNotExtendBaseProviderError(); }