snapback4 0.0.7 → 0.0.8
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/local.js +17 -4
- package/dist/replica/interpreter.js +3 -1
- package/package.json +2 -2
package/dist/local.js
CHANGED
|
@@ -190,11 +190,27 @@ export async function createLocalClient(options) {
|
|
|
190
190
|
return store.read(async (tx) => (await tx.side("outbox").all()).map((e) => e.value).sort((a, b) => (a.id < b.id ? -1 : 1)));
|
|
191
191
|
}
|
|
192
192
|
let flushing = false;
|
|
193
|
+
let flushAgain = false;
|
|
193
194
|
async function flush() {
|
|
194
|
-
|
|
195
|
+
// A write queued while a flush runs is flushed by the same flush, on
|
|
196
|
+
// its next pass: nothing waits for the next link change.
|
|
197
|
+
if (flushing) {
|
|
198
|
+
flushAgain = true;
|
|
195
199
|
return;
|
|
200
|
+
}
|
|
196
201
|
flushing = true;
|
|
197
202
|
try {
|
|
203
|
+
do {
|
|
204
|
+
flushAgain = false;
|
|
205
|
+
await flushOnce();
|
|
206
|
+
} while (flushAgain && link === "online" && !closed);
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
flushing = false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
async function flushOnce() {
|
|
213
|
+
{
|
|
198
214
|
for (const entry of await queued()) {
|
|
199
215
|
if (link !== "online")
|
|
200
216
|
return;
|
|
@@ -228,9 +244,6 @@ export async function createLocalClient(options) {
|
|
|
228
244
|
void rerun(watch);
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
|
-
finally {
|
|
232
|
-
flushing = false;
|
|
233
|
-
}
|
|
234
247
|
}
|
|
235
248
|
const settled = new Map();
|
|
236
249
|
const client = {
|
|
@@ -625,7 +625,9 @@ export class Interpreter {
|
|
|
625
625
|
this.env.set(lane.binding, source);
|
|
626
626
|
await this.statements(lane.setup ?? [], merge.site);
|
|
627
627
|
this.pageDepth++;
|
|
628
|
-
|
|
628
|
+
// One row past the page per lane, so a lane that alone fills the
|
|
629
|
+
// page still shows there is more (as on the server).
|
|
630
|
+
const rows = await this.scan({ ...lane.scan, take: { Literal: take + 1 } });
|
|
629
631
|
this.pageDepth = depth;
|
|
630
632
|
for (const row of rows) {
|
|
631
633
|
if (seen.has(row.id))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snapback4",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Snapback 4: the card (contract), the online and local-first clients (IndexedDB, SQLite), React hooks, sign-in, a labelled mock, and the `snapback4` CLI. LLP 3000.",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"snapback4-darwin-arm64": "0.0.
|
|
45
|
+
"snapback4-darwin-arm64": "0.0.8"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc -p tsconfig.build.json",
|