diff --git a/code/lib/manager-api/src/lib/stories.ts b/code/lib/manager-api/src/lib/stories.ts index 9d6b1817e677..22a08e89d590 100644 --- a/code/lib/manager-api/src/lib/stories.ts +++ b/code/lib/manager-api/src/lib/stories.ts @@ -196,9 +196,7 @@ export const transformStoryIndexToStoriesHash = ( if (parent === id) { throw new Error( dedent` - Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}' - - Did you create a path that uses the separator char accidentally, such as 'Vue ' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128 + Invalid title "${title}" ending in slash: ${id} ` ); } diff --git a/code/ui/manager/src/components/sidebar/Refs.tsx b/code/ui/manager/src/components/sidebar/Refs.tsx index 1cd5c6c7a5a0..bbaa2734f9ef 100644 --- a/code/ui/manager/src/components/sidebar/Refs.tsx +++ b/code/ui/manager/src/components/sidebar/Refs.tsx @@ -17,6 +17,8 @@ import type { Highlight, RefType } from './types'; import { getStateType } from '../../utils/tree'; import { CollapseIcon } from './components/CollapseIcon'; +import type { API_IndexHash } from '@storybook/types'; + export interface RefProps { isLoading: boolean; isBrowsing: boolean; @@ -128,6 +130,28 @@ export const Ref: FC = React. [api, isMain, refId] ); + const filteredIndex = {} as API_IndexHash; + + function getLastWord(str: string) { + const words = str.split(' '); + return words[words.length - 1]; + } + + // Iterate through the index data + for (const key in index) { + // Check if the key starts with id of the error message + if ( + indexError && + indexError.hasOwnProperty('message') && + key.startsWith(getLastWord(indexError.message)) + ) { + // Do not include this item in the filtered index + continue; + } + // Otherwise, include it in the filtered index + filteredIndex[key] = index[key]; + } + return ( <> {isMain || ( @@ -145,7 +169,23 @@ export const Ref: FC = React. {isExpanded && ( {state === 'auth' && } - {state === 'error' && } + {state === 'error' && ( + <> + + + + )} {state === 'loading' && } {state === 'empty' && } {state === 'ready' && (