@syncular/client 0.72.1 → 0.72.2
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/apply.js +5 -5
- package/dist/reactive-store.js +4 -1
- package/package.json +3 -3
- package/src/apply.ts +6 -6
- package/src/reactive-store.ts +3 -0
package/dist/apply.js
CHANGED
|
@@ -350,10 +350,10 @@ export async function applySqliteSegment(db, schema, table, bytes, descriptor, o
|
|
|
350
350
|
};
|
|
351
351
|
let [boundary, where, params] = range(undefined, 1024);
|
|
352
352
|
let applied = 0;
|
|
353
|
-
// §5.3: the first chunk holds 1,024 rows. A later chunk holds at
|
|
354
|
-
// twice the rows of the one before, at most 65,536,
|
|
355
|
-
// the one before applied per
|
|
356
|
-
// replaying chunk holds one statement.
|
|
353
|
+
// §5.3: the first chunk holds 1,024 rows. A later chunk holds at least
|
|
354
|
+
// 1,024 rows, at most twice the rows of the one before, at most 65,536,
|
|
355
|
+
// and at most the rows the one before applied per 250 ms from its start
|
|
356
|
+
// to its COMMIT; a replaying chunk holds one statement.
|
|
357
357
|
for (let size = 1024;;) {
|
|
358
358
|
if (options.isCurrent?.() === false)
|
|
359
359
|
return applied;
|
|
@@ -409,7 +409,7 @@ export async function applySqliteSegment(db, schema, table, bytes, descriptor, o
|
|
|
409
409
|
await yieldToHost();
|
|
410
410
|
if (boundary === undefined || applied === count)
|
|
411
411
|
break;
|
|
412
|
-
size = Math.max(
|
|
412
|
+
size = Math.max(1024, Math.min(2 * chunk, 65_536, Math.floor((chunk * 250) / duration)));
|
|
413
413
|
[boundary, where, params] = range(boundary, Math.min(1024, size));
|
|
414
414
|
}
|
|
415
415
|
if (applied !== count)
|
package/dist/reactive-store.js
CHANGED
|
@@ -454,7 +454,10 @@ class QueryEntry {
|
|
|
454
454
|
this.#requestRead();
|
|
455
455
|
}
|
|
456
456
|
#publish(next) {
|
|
457
|
-
|
|
457
|
+
// A revision change alone publishes nothing, except the first answer:
|
|
458
|
+
// an empty answered read differs from an unread one by its revision.
|
|
459
|
+
if ((next.revision === undefined) === (this.#state.revision === undefined) &&
|
|
460
|
+
next.rows === this.#state.rows &&
|
|
458
461
|
next.phase === this.#state.phase &&
|
|
459
462
|
next.error === this.#state.error &&
|
|
460
463
|
next.isRefreshing === this.#state.isRefreshing &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/client",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.2",
|
|
4
4
|
"description": "Syncular TypeScript client core — offline-first sync over SQLite (WASM/OPFS, Bun, Node)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -121,11 +121,11 @@
|
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"@sqlite.org/sqlite-wasm": "^3.53.0-build1",
|
|
124
|
-
"@syncular/core": "0.72.
|
|
124
|
+
"@syncular/core": "0.72.2"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@electric-sql/pglite": "^0.5.4",
|
|
128
|
-
"@syncular/server": "0.72.
|
|
128
|
+
"@syncular/server": "0.72.2",
|
|
129
129
|
"playwright": "1.63.0",
|
|
130
130
|
"vite": "8.3.4"
|
|
131
131
|
}
|
package/src/apply.ts
CHANGED
|
@@ -588,10 +588,10 @@ export async function applySqliteSegment(
|
|
|
588
588
|
};
|
|
589
589
|
let [boundary, where, params] = range(undefined, 1024);
|
|
590
590
|
let applied = 0;
|
|
591
|
-
// §5.3: the first chunk holds 1,024 rows. A later chunk holds at
|
|
592
|
-
// twice the rows of the one before, at most 65,536,
|
|
593
|
-
// the one before applied per
|
|
594
|
-
// replaying chunk holds one statement.
|
|
591
|
+
// §5.3: the first chunk holds 1,024 rows. A later chunk holds at least
|
|
592
|
+
// 1,024 rows, at most twice the rows of the one before, at most 65,536,
|
|
593
|
+
// and at most the rows the one before applied per 250 ms from its start
|
|
594
|
+
// to its COMMIT; a replaying chunk holds one statement.
|
|
595
595
|
for (let size = 1024; ;) {
|
|
596
596
|
if (options.isCurrent?.() === false) return applied;
|
|
597
597
|
const started = now();
|
|
@@ -679,8 +679,8 @@ export async function applySqliteSegment(
|
|
|
679
679
|
await yieldToHost();
|
|
680
680
|
if (boundary === undefined || applied === count) break;
|
|
681
681
|
size = Math.max(
|
|
682
|
-
|
|
683
|
-
Math.min(2 * chunk, 65_536, Math.floor((chunk *
|
|
682
|
+
1024,
|
|
683
|
+
Math.min(2 * chunk, 65_536, Math.floor((chunk * 250) / duration)),
|
|
684
684
|
);
|
|
685
685
|
[boundary, where, params] = range(boundary, Math.min(1024, size));
|
|
686
686
|
}
|
package/src/reactive-store.ts
CHANGED
|
@@ -601,7 +601,10 @@ class QueryEntry<Row> implements ExternalStoreEntry<LiveQueryResult<Row>> {
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
#publish(next: LiveQueryResult<Row>): void {
|
|
604
|
+
// A revision change alone publishes nothing, except the first answer:
|
|
605
|
+
// an empty answered read differs from an unread one by its revision.
|
|
604
606
|
if (
|
|
607
|
+
(next.revision === undefined) === (this.#state.revision === undefined) &&
|
|
605
608
|
next.rows === this.#state.rows &&
|
|
606
609
|
next.phase === this.#state.phase &&
|
|
607
610
|
next.error === this.#state.error &&
|