File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,8 +397,8 @@ export const AddSidebar = () => {
397397
398398 const { currentId, subsectionId, sectionId } = selectedContainerState ;
399399 const sectionIndex = sections . findIndex ( ( section ) => section . id === sectionId ) ;
400- const subsectionIndex = sections
401- . find ( ( section ) => section . id === sectionId )
400+ const section = sectionIndex >= 0 ? sections [ sectionIndex ] : undefined ;
401+ const subsectionIndex = section
402402 ?. childInfo . children . findIndex ( ( subsection ) => subsection . id === subsectionId ) ?? - 1 ;
403403
404404 if ( currentId === subsectionId && sectionId ) {
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export const OutlineAlignSidebar = () => {
1919 const handleBack = ( ) => {
2020 const { currentId, subsectionId, sectionId } = selectedContainerState || { } ;
2121 const sectionIndex = sections . findIndex ( ( section ) => section . id === sectionId ) ;
22- const subsectionIndex = sections
23- . find ( ( section ) => section . id === sectionId )
22+ const section = sectionIndex >= 0 ? sections [ sectionIndex ] : undefined ;
23+ const subsectionIndex = section
2424 ?. childInfo . children . findIndex ( ( subsection ) => subsection . id === subsectionId ) ?? - 1 ;
2525
2626 if ( ! currentId ) {
You can’t perform that action at this time.
0 commit comments