File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -486,6 +486,7 @@ export function TutorialWindow({
486486 const [ isClosed , setIsClosed ] = useState ( tutorialData . isClosed ) ;
487487
488488 const { article : activeArticleFromSearch } = useSearch ( { strict : false } ) ;
489+ const navigate = useNavigate ( ) ;
489490
490491 const [ activeStep , setActiveStep ] = useState (
491492 tutorialData . tutorialStep || articles [ 0 ] . title ,
@@ -498,13 +499,28 @@ export function TutorialWindow({
498499 ) {
499500 const articleInSearch = decodeURIComponent (
500501 activeArticleFromSearch . toLowerCase ( ) ,
502+ ) . trim ( ) ;
503+
504+ console . info ( {
505+ articleInSearch,
506+ } ) ;
507+
508+ const article = articles . find (
509+ ( a ) => a . title . toLowerCase ( ) . trim ( ) === articleInSearch ,
501510 ) ;
502511
503- if ( articles . find ( ( a ) => a . title === articleInSearch ) ) {
504- setActiveStep ( articleInSearch ) ;
512+ if ( article ) {
513+ setActiveStep ( article . title ) ;
514+ navigate ( {
515+ to : "." ,
516+ search : ( { article : _ , ...old } ) => {
517+ return { ...old } ;
518+ } ,
519+ replace : true ,
520+ } ) ;
505521 }
506522 }
507- } , [ activeArticleFromSearch ] ) ;
523+ } , [ activeArticleFromSearch , navigate ] ) ;
508524
509525 const router = useRouter ( ) ;
510526
You can’t perform that action at this time.
0 commit comments