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

Correctly set page prop back to 0 when resetPageOnUpdate is enabled #1334

Merged
merged 2 commits into from
Mar 3, 2024

Conversation

cpba
Copy link
Contributor

@cpba cpba commented Mar 12, 2023

Otherwise if there is a server side search while we're on a page other than 0, the current page is set back to 0 but the prop retains its old value. Causing issues with server side pagination as the page number that the server receives is different from the one the client is displaying.

Fixes #1311

otherwise the current page will be set to 0 but the prop will still
retain its old value, causing issues with server side pagination.
@mnsrulz
Copy link

mnsrulz commented Mar 24, 2023

@cpba i am noticing if you enable server side search with this change, each search is issuing two api calls instead of one. Perhaps a quick fix is to check if the props page value > 0 then only set it to 0?

@cpba
Copy link
Contributor Author

cpba commented Mar 25, 2023

Perhaps a quick fix is to check if the props page value > 0 then only set it to 0?

Yes, that would work. I think it'd still fire two calls if the search is started from a different page, but that'll only happen once so perhaps it isn't very important.

I'll make the change.

this way we prevent duplicated api calls.
@mnsrulz
Copy link

mnsrulz commented Mar 26, 2023

I think it'd still fire two calls if the search is started from a different page, but that'll only happen once so perhaps it isn't very important.

Totally inline with that. There might be a better way to eliminate it which @afshinm can guide…

@afshinm afshinm added the bug fix Something isn't working label Mar 3, 2024
@afshinm afshinm merged commit 95c8def into grid-js:master Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server side pagination -- page number is not reset when resetPageOnUpdate is enabled
3 participants