components icon indicating copy to clipboard operation
components copied to clipboard

fix(paginator): update page index if invalid after length change

Open crisbeto opened this issue 5 years ago • 3 comments

Updates the page index of a paginator if its length changed to something where the index isn't valid anymore (e.g. the user is on the last page and the amount of pages becomes smaller).

Fixes #14520.

crisbeto avatar Dec 24 '18 14:12 crisbeto

I've been looking at @andrewseguin 's comments and I think that concern would be addressed by moving L136 to L130 (and L139 to L141, so that all the new code happens inside of the then callback. The potential race condition arises because you're computing maxPageIndex and looking at the current _pageIndex value during the first tick but changing them during the second. If you do the comparison and change in a single tick, the race is eliminated.

thw0rted avatar Aug 06 '21 14:08 thw0rted

@crisbeto it looks like your PR has fallen out of date please rebase the PR.

nvaralakshmi avatar Nov 23 '21 08:11 nvaralakshmi

I've rebased the PR.

crisbeto avatar Nov 23 '21 10:11 crisbeto