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

Clear pagination after filter change #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mskalnik
Copy link
Contributor

No description provided.

@@ -64,6 +64,12 @@ class ListPresenterBare<T, R extends DeepKeyOf<T>> extends React.PureComponent<I
}
}

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