Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Makes sure to add a unique key to the orderBy to prevent missing/duplicate items when pagination because of unstable sorting, when keys are the same.
Description
Re-does #16552
This adds a stableSort option to tables, to add an additional pagination key so that a unique key is always available when sorting, in the case of keys with the same value. Fixes #15865
Visual changes
Sorting on provider type (which is AWS for multiple). See that 25 and 26 are on page 1 and 3. There are some values missing entirely when paginating.
Before


After
Functional changes
This adds a
$table->stableSort()
option which adds the sorting. Default behavior in v3 is off. Maybe in v4 we can turn it on by default. (and use$table->stableSort(false)
instead.The query changes to add a secondary orderBy. For custom queries, in the future we might make the stable sort key configurable?
composer cs
command.