@@ -15,7 +15,7 @@ import {
1515import TitleBase from './TitleBase'
1616import { Portal } from '@/components/Portal'
1717import { routerTo } from '@/utils'
18- import { selectIsPremium } from '../global/globalSlice'
18+ import { selectCurrentPage , selectIsPremium } from '../global/globalSlice'
1919
2020interface RankTitleProps {
2121 otherRoots : { [ key in OrderBy ] ?: HTMLElement }
@@ -24,6 +24,7 @@ interface RankTitleProps {
2424const RankTitle : FC < RankTitleProps > = ( { otherRoots } ) => {
2525 const [ params , setParams ] = useState ( parseParams ( ) )
2626 const isPremium = useAppSelector ( selectIsPremium )
27+ const currentPage = useAppSelector ( selectCurrentPage )
2728
2829 useEffect ( ( ) => {
2930 SORT_KEY . forEach ( ( { key } ) => {
@@ -47,9 +48,16 @@ const RankTitle: FC<RankTitleProps> = ({ otherRoots }) => {
4748 // 如果第一次访问的 url 中,包含 customSort,则需要进行特殊的处理。
4849 void ( async function ( ) {
4950 if ( params . custom ) {
50- // 如果包含 customSort,那么一定是包含 id 的 sroting,则一定会重定向一次。
51- await once ( 'routeChangeComplete' )
52-
51+ /**
52+ * 在题库页中,如果包含 custom,那么一定是包含 id 的 sroting,
53+ * 则一定会重定向到 sroting 等于 `ASCENDING`,
54+ * 需要等待重定向完成后,再通过路由跳转到到包含自定义参数的 url
55+ *
56+ * 而在题单页中,则不会进行重定向,就不用去等待
57+ */
58+ if ( currentPage === 'problemsetPage' ) {
59+ await once ( 'routeChangeComplete' )
60+ }
5361 handleCustomSort ( ) ( )
5462 }
5563 } ) ( )
0 commit comments