@rebasepro/client 0.14.1-canary.g7e666eb → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +10 -1
- package/dist/index.es.js.map +1 -1
- package/dist/offline-query.d.ts +7 -0
- package/package.json +4 -4
- package/src/offline-query.test.ts +20 -3
- package/src/offline-query.ts +9 -1
package/dist/index.es.js
CHANGED
|
@@ -4104,6 +4104,13 @@ function matchesParams(row, params) {
|
|
|
4104
4104
|
* Sort in place, Postgres-style: nulls last ascending, first descending, with
|
|
4105
4105
|
* the row id as a tiebreak so paging through an unsorted-but-equal run does
|
|
4106
4106
|
* not shuffle rows between pages.
|
|
4107
|
+
*
|
|
4108
|
+
* The tiebreak runs *descending*, which is not a taste: every server-side sort
|
|
4109
|
+
* ends on `id DESC` — `FetchService.buildOrderExpressions` appends it to make
|
|
4110
|
+
* the ordering total, and the keyset cursor is built to match. This ran
|
|
4111
|
+
* ascending, so two rows sharing a sort value came back from the local overlay
|
|
4112
|
+
* in the opposite order to the server's, and {@link isLocallySortable} called
|
|
4113
|
+
* that page exactly reproducible while it was not.
|
|
4107
4114
|
*/
|
|
4108
4115
|
function sortRows(rows, orderBy) {
|
|
4109
4116
|
const keys = normalizeOrderBy(orderBy);
|
|
@@ -4130,8 +4137,10 @@ function compareOnKey(a, b, field, direction) {
|
|
|
4130
4137
|
if (cmp === void 0 || cmp === 0) return 0;
|
|
4131
4138
|
return cmp * (direction === "desc" ? -1 : 1);
|
|
4132
4139
|
}
|
|
4140
|
+
/** The last word, and the server's: `id DESC`. */
|
|
4133
4141
|
function tiebreak(a, b) {
|
|
4134
|
-
|
|
4142
|
+
const cmp = compareValues(a.id, b.id);
|
|
4143
|
+
return cmp === void 0 ? 0 : -cmp;
|
|
4135
4144
|
}
|
|
4136
4145
|
/**
|
|
4137
4146
|
* Resolve `page`/`offset`/`limit` the way the server does.
|