Conversation
페이지네이션 초기화되는 버그 수정
There was a problem hiding this comment.
Pull request overview
This PR fixes a pagination bug where the page was being reset to 1 on every component mount, causing list display issues. The fix adds a conditional check to only reset pagination when the search term is not empty.
Key changes:
- Modified pagination reset logic to conditionally trigger only when searchTerm is not empty
- Removed unused
useimport (added but not utilized) - Code formatting improvements (consolidated multi-line statements)
Comments suppressed due to low confidence (1)
src/components/boardList/boardList.jsx:1
- Unused import use.
import { useState, useEffect, use } from "react";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,4 +1,4 @@ | |||
| import { useState, useEffect } from "react"; | |||
| import { useState, useEffect, use } from "react"; | |||
There was a problem hiding this comment.
The use import from React is not used anywhere in this component. This import should be removed to keep the code clean.
| import { useState, useEffect, use } from "react"; | |
| import { useState, useEffect } from "react"; |
|
|
||
| useEffect(() => { | ||
| setCurrentPage(1); | ||
| if (searchTerm !== "") setCurrentPage(1); |
There was a problem hiding this comment.
The condition if (searchTerm !== "") only resets pagination when search term is not empty. However, pagination should also reset when the user clears the search (searchTerm changes from non-empty to empty). Consider using a more comprehensive approach that resets pagination whenever searchTerm changes, or track the previous value to reset on any change.
| if (searchTerm !== "") setCurrentPage(1); | |
| setCurrentPage(1); |
개요
페이지네이션 초기화되는 버그 수정
이슈 번호 209
변경사항
컴포넌트 마운트 됐을때 페이지네이션 초기화되서 리스트 꼬임 막음