Skip to content

Clear pagination after filter change#152

Open
mskalnik wants to merge 1 commit intongs-doo:masterfrom
mskalnik:clear-pagination-on-filter-change
Open

Clear pagination after filter change#152
mskalnik wants to merge 1 commit intongs-doo:masterfrom
mskalnik:clear-pagination-on-filter-change

Conversation

@mskalnik
Copy link
Contributor

No description provided.

}

public componentDidUpdate(prevProps: IListPresenter<T, R>) {
if (prevProps.values !== this.props.values) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does this do?
To me it does not make sense that you clear everything if any property of the filter changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sets page and perPage to initial values if a filter changes. It would be equivalent to this.setState({ page: 0, perPage: 20 }), but I reused the existing code so it doesn't get duplicated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this seems wrong :)
I would expect that if you click on next pagination once filter is changed to get a dialog box which asks you do you want to restart the search (without reseting per page) or just continue searching using the old filter.
So you should maintain some invalidation flag which gets cleared on submit.

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.

2 participants