-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#20): set the start index correctly when some filter is applied #107
Conversation
mari1912
commented
Aug 14, 2024
- closes [Bug] [Builds Tab] Itens navigation breaks after filters change #20
@@ -13,6 +13,7 @@ export const usePagination = ( | |||
const [endIndex, setEndIndex] = useState(0); | |||
|
|||
useEffect(() => { | |||
setStartIndex(0); //restart the index whenever there is a change in filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't work if the itemsPorPage and totalItems have the same count, needs to add diffFilter
and filter
to the dependency array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will need useSearch
for this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an example when it's possible? I tried with http://localhost:5173/tree/0bdf955f408e17b64d9dc4de09d3a2fc4f233aca?tableFilter=all¤tTreeDetailsTab=treeDetails.builds&diffFilter=%7B%7D changing the itemsPerPage and it doesn't seem to be broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be a rare case if not never, but it is possible since are primitives in javascript and the useEffect
wont detect a change if they are the same but coming from another source
c351dfe
to
0b6bcea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's also missing tableFilter
which also changes the table
0b6bcea
to
0aac5ed
Compare
0aac5ed
to
718726b
Compare