rails-markup 1.4.1 → 1.4.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/rails_markup/toolbar.js +33 -4
- data/lib/rails_markup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34e44f1b30e4c51432e862ee09efd9d1f72e906a41e0e38f9c7553267f737d6f
|
|
4
|
+
data.tar.gz: '0909684467d87ed6a1248657ea2fc0e120956b66203c55b47750e74b57971bcb'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea571e4c90037645f9f81ddc6e95710ffd6333addee88f6b43b3352ee8be8bcf9afb9b4d0d2868965f30825c370bf668a6e3a61e7fe345c6ae2469e8e205216c
|
|
7
|
+
data.tar.gz: ec0f2ff1ae946b95e7e6c6a7c0fb90429faa8bab7e8cbe30763a09440056760ab9049aed14b296a36c52095f9c1eae5d45941c6a1ccae8bcc346e5f12d03a5d3
|
|
@@ -1197,6 +1197,8 @@
|
|
|
1197
1197
|
|
|
1198
1198
|
if (result.kind === "success") {
|
|
1199
1199
|
if (!this._outboxEntryMatches(snapshot)) {
|
|
1200
|
+
const supersedingDelete = this._advanceSupersedingDeleteBaseRevision(snapshot, result.data);
|
|
1201
|
+
if (supersedingDelete === "failed") break;
|
|
1200
1202
|
clientIds.push(clientId);
|
|
1201
1203
|
continue;
|
|
1202
1204
|
}
|
|
@@ -1242,6 +1244,25 @@
|
|
|
1242
1244
|
}
|
|
1243
1245
|
},
|
|
1244
1246
|
|
|
1247
|
+
_advanceSupersedingDeleteBaseRevision(snapshot, server) {
|
|
1248
|
+
const current = this.outbox[snapshot.clientId];
|
|
1249
|
+
const supersedesUpsert = snapshot.type === "upsert"
|
|
1250
|
+
&& current?.type === "delete"
|
|
1251
|
+
&& current.clientId === snapshot.clientId
|
|
1252
|
+
&& Number.isInteger(current.revision)
|
|
1253
|
+
&& current.revision > snapshot.revision
|
|
1254
|
+
&& Number.isInteger(server?.revision);
|
|
1255
|
+
if (!supersedesUpsert) return "not-applicable";
|
|
1256
|
+
|
|
1257
|
+
const tombstone = this._immutableCopy(current);
|
|
1258
|
+
const committed = this._commitLocalStateChange(() => {
|
|
1259
|
+
if (!this._outboxEntryMatches(tombstone)) return;
|
|
1260
|
+
const baseRevision = Number.isInteger(tombstone.baseRevision) ? tombstone.baseRevision : 0;
|
|
1261
|
+
this.outbox[snapshot.clientId].baseRevision = Math.max(baseRevision, server.revision);
|
|
1262
|
+
});
|
|
1263
|
+
return committed ? "advanced" : "failed";
|
|
1264
|
+
},
|
|
1265
|
+
|
|
1245
1266
|
async _sendOutboxEntry(snapshot) {
|
|
1246
1267
|
const request = this._sameOriginMutationRequest(`/annotations/${encodeURIComponent(snapshot.clientId)}`);
|
|
1247
1268
|
if (!request) return { kind: "auth", message: "Sync unavailable: endpoint must be same-origin" };
|
|
@@ -1434,12 +1455,20 @@
|
|
|
1434
1455
|
if (annotation) annotation.syncState = "failed";
|
|
1435
1456
|
return;
|
|
1436
1457
|
}
|
|
1458
|
+
if (!annotation) {
|
|
1459
|
+
entry.syncState = "failed";
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
// Recreate once from the complete desired browser state. Replaying a
|
|
1463
|
+
// narrow edit delta onto a new row can omit required fields and lose
|
|
1464
|
+
// the user's annotation to a permanent validation failure.
|
|
1465
|
+
annotation.dirtyFields = this._legacyDirtyFields(annotation);
|
|
1466
|
+
entry.annotation = this._desiredState(annotation);
|
|
1467
|
+
entry.dirtyFields = annotation.dirtyFields.slice();
|
|
1437
1468
|
entry.baseRevision = 0;
|
|
1438
1469
|
entry.missingConflictRebased = true;
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
annotation.serverRevision = 0;
|
|
1442
|
-
}
|
|
1470
|
+
annotation.serverId = null;
|
|
1471
|
+
annotation.serverRevision = 0;
|
|
1443
1472
|
resolution = "retry";
|
|
1444
1473
|
return;
|
|
1445
1474
|
}
|
data/lib/rails_markup/version.rb
CHANGED