Skip to content

Commit 082713b

Browse files
authored
fix : 난이도 카테고리 변경 시 페이지 초기화 (#142)
1 parent c5160a0 commit 082713b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • src/app/(auth)/(navigationsBarLayout)/problems

src/app/(auth)/(navigationsBarLayout)/problems/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { useState } from 'react';
3+
import { useEffect, useState } from 'react';
44
import Image from 'next/image';
55
import ProblemTable from './ui/Table';
66
import { useProblemListQuery } from '@/entities/problems/model/query';
@@ -97,6 +97,9 @@ const ProblemsList = () => {
9797

9898
const totalPages = data?.totalPages ?? 0;
9999

100+
useEffect(() => {
101+
setCurrentPage(0);
102+
}, [categoryCode, difficulty]);
100103
return (
101104
<div className="flex flex-col px-10 py-18 w-full gap-4 justify-center items-center">
102105
<div className="flex flex-col max-w-[1600px] w-full gap-6">

0 commit comments

Comments
 (0)