Skip to content

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

Merged
afshinm merged 2 commits into
grid-js:masterfrom
cpba:fix-resetpageonupdate
Mar 3, 2024
Merged

afshinm merged 2 commits into
grid-js:masterfrom
cpba:fix-resetpageonupdate

Conversation

@cpba

@cpba cpba commented Mar 12, 2023

Copy link
Copy Markdown
Contributor

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

mnsrulz commented Mar 24, 2023

Copy link
Copy Markdown

@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

cpba commented Mar 25, 2023

Copy link
Copy Markdown
Contributor Author

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

mnsrulz commented Mar 26, 2023

Copy link
Copy Markdown

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