File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/widgets/code-panel/ui/CodePanel/CodeEditor Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11import { useEffect , useState } from "react" ;
2- import { useNavigate , useParams } from "react-router-dom" ;
2+ import { useLocation , useNavigate , useParams } from "react-router-dom" ;
33import { useDebouncedCallback } from "use-debounce" ;
44import { useDuelTaskSelection , useGetDuelQuery } from "entities/duel" ;
55import { selectCurrentUser } from "entities/user" ;
@@ -17,6 +17,7 @@ import styles from "./CodeEditor.module.scss";
1717function CodeEditor ( ) {
1818 const { duelId } = useParams ( ) ;
1919
20+ const location = useLocation ( ) ;
2021 const navigate = useNavigate ( ) ;
2122 const dispatch = useAppDispatch ( ) ;
2223
@@ -66,7 +67,16 @@ function CodeEditor() {
6667 } ;
6768
6869 const onSubmissionStart = ( ) => {
69- if ( duelId ) navigate ( `/duel/${ duelId } /submissions` ) ;
70+ if ( ! duelId ) return ;
71+ const nextParams = new URLSearchParams ( location . search ) ;
72+ if ( selectedTaskKey ) {
73+ nextParams . set ( "task" , selectedTaskKey ) ;
74+ }
75+ const search = nextParams . toString ( ) ;
76+ navigate ( {
77+ pathname : `/duel/${ duelId } /submissions` ,
78+ search : search ? `?${ search } ` : "" ,
79+ } ) ;
7080 } ;
7181
7282 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments