Skip to content

Commit 6b40bbe

Browse files
committed
fix(problems): 随机题目时测试样例不会跟着变化
1 parent 56d51dd commit 6b40bbe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/content/pages/problems/Random.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const Random: FC = () => {
9191

9292
let nextUrl = `/problems/${allQuestions[i].titleSlug}/`
9393
if (favorite !== 'all') nextUrl += `?favorite=${favorite}`
94-
routerTo(nextUrl)
94+
routerTo(nextUrl, false)
9595
}
9696

9797
return (

src/content/utils/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ export const problemsetPageIsLoad = async (): Promise<boolean> => {
308308
return getComputedStyle(hr)['visibility'] === 'visible'
309309
}
310310

311-
export function routerTo(url: string): void {
311+
export function routerTo(url: string, shallow = true): void {
312312
const next = (window as any).next
313313
if (!next) return
314-
next.router.push(url, undefined, { shallow: true })
314+
next.router.push(url, undefined, { shallow })
315315
}
316316

317317
export function setRef<T>(el: T, ref?: React.Ref<T>): void {

0 commit comments

Comments
 (0)