Skip to content
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

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

mari1912
Copy link
Collaborator

@mari1912 mari1912 self-assigned this Aug 14, 2024
@@ -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
Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator Author

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&currentTreeDetailsTab=treeDetails.builds&diffFilter=%7B%7D changing the itemsPerPage and it doesn't seem to be broken

Copy link
Collaborator

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

@mari1912 mari1912 force-pushed the fix/table-navigation branch from c351dfe to 0b6bcea Compare August 15, 2024 16:17
Copy link
Collaborator

@WilsonNet WilsonNet left a 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

@mari1912 mari1912 force-pushed the fix/table-navigation branch from 0b6bcea to 0aac5ed Compare August 19, 2024 12:36
@mari1912 mari1912 force-pushed the fix/table-navigation branch from 0aac5ed to 718726b Compare August 19, 2024 12:48
@mari1912 mari1912 merged commit abe96cc into main Aug 20, 2024
5 checks passed
@mari1912 mari1912 deleted the fix/table-navigation branch August 20, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [Builds Tab] Itens navigation breaks after filters change
2 participants