@@ -98,7 +98,10 @@ export interface StoplightProjectProps extends RoutingProps {
9898}
9999
100100const StoplightProjectImpl : React . FC < StoplightProjectProps > = ( { projectId, collapseTableOfContents = false } ) => {
101- const { branchSlug : encodedBranchSlug = '' , nodeSlug = '' } = useParams < { branchSlug ?: string ; nodeSlug : string } > ( ) ;
101+ const { branchSlug : encodedBranchSlug = '' , '*' : nodeSlug = '' } = useParams < {
102+ branchSlug ?: string ;
103+ '*' : string ;
104+ } > ( ) ;
102105 const branchSlug = decodeURIComponent ( encodedBranchSlug ) ;
103106 const navigate = useNavigate ( ) ;
104107
@@ -110,7 +113,7 @@ const StoplightProjectImpl: React.FC<StoplightProjectProps> = ({ projectId, coll
110113 isError,
111114 error : nodeError ,
112115 } = useGetNodeContent ( {
113- nodeSlug,
116+ nodeSlug : nodeSlug ?? '' ,
114117 projectId,
115118 branchSlug,
116119 } ) ;
@@ -171,7 +174,7 @@ const ProjectNode: React.FC<StoplightProjectProps> = ({
171174 tryItCredentialsPolicy,
172175 tryItCorsProxy,
173176} ) => {
174- const { branchSlug : encodedBranchSlug = '' , nodeSlug = '' } = useParams < { branchSlug ?: string ; nodeSlug : string } > ( ) ;
177+ const { branchSlug : encodedBranchSlug = '' , '*' : nodeSlug = '' } = useParams < { branchSlug ?: string ; '*' : string } > ( ) ;
175178 const branchSlug = decodeURIComponent ( encodedBranchSlug ) ;
176179 const [ isLoadingNode , isTocFetched , isError , nodeError , node ] = useOutletContext < any > ( ) ;
177180
@@ -233,11 +236,8 @@ const StoplightProjectRouter = ({
233236 const InternalRoutes = ( ) => (
234237 < Routes >
235238 < Route path = "/" element = { < StoplightProjectImpl { ...props } /> } >
236- < Route path = "/branches/:branchSlug/:nodeSlug/*" element = { < ProjectNode { ...props } /> } />
237-
238- < Route path = "/:nodeSlug/*" element = { < ProjectNode { ...props } /> } />
239-
240- < Route element = { < ProjectNode { ...props } /> } />
239+ < Route path = "/branches/:branchSlug/*" element = { < ProjectNode { ...props } /> } />
240+ < Route path = "/*" element = { < ProjectNode { ...props } /> } />
241241 </ Route >
242242 </ Routes >
243243 ) ;
0 commit comments