mnfst 0.5.194 → 0.5.195
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/lib/manifest.chat.js +17 -4
- package/lib/manifest.integrity.json +1 -1
- package/package.json +1 -1
package/lib/manifest.chat.js
CHANGED
|
@@ -100,13 +100,17 @@
|
|
|
100
100
|
function commitParticipants() { state.participants = [..._participants.values()]; rev().n++; }
|
|
101
101
|
function commitTyping() { state.typing = [..._typing.values()]; rev().n++; }
|
|
102
102
|
|
|
103
|
+
// server echo reconciles body/media/status onto the local copy
|
|
104
|
+
function merge(target, incoming) {
|
|
105
|
+
Object.assign(target.body, incoming.body);
|
|
106
|
+
for (const k of Object.keys(incoming)) if (k !== 'body' && k !== '_seq') target[k] = incoming[k];
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
function upsert(raw) {
|
|
104
110
|
const incoming = normalize(raw, ++seq);
|
|
105
111
|
const prev = incoming.id != null ? _byId.get(incoming.id) : null;
|
|
106
112
|
if (prev) {
|
|
107
|
-
|
|
108
|
-
Object.assign(prev.body, incoming.body);
|
|
109
|
-
for (const k of Object.keys(incoming)) if (k !== 'body' && k !== '_seq') prev[k] = incoming[k];
|
|
113
|
+
merge(prev, incoming);
|
|
110
114
|
} else {
|
|
111
115
|
_msgs.push(incoming);
|
|
112
116
|
if (incoming.id != null) _byId.set(incoming.id, incoming);
|
|
@@ -178,7 +182,16 @@
|
|
|
178
182
|
try {
|
|
179
183
|
const ack = await adapter.send(conversationId, Object.assign({}, draft, { body }));
|
|
180
184
|
_byId.delete(tmp);
|
|
181
|
-
|
|
185
|
+
// A bus that echoes our own send can beat the ack; that echo lands
|
|
186
|
+
// while this row is still tmp-keyed, so it appended as its own entry.
|
|
187
|
+
const echo = ack.id != null ? _byId.get(ack.id) : null;
|
|
188
|
+
if (echo && echo !== local) {
|
|
189
|
+
merge(local, echo);
|
|
190
|
+
const at = _msgs.indexOf(echo); if (at > -1) _msgs.splice(at, 1);
|
|
191
|
+
}
|
|
192
|
+
local.id = ack.id; local._optimistic = false;
|
|
193
|
+
if (ack.ts != null) local.ts = ack.ts;
|
|
194
|
+
if (local.status === 'pending') local.status = 'sent';
|
|
182
195
|
if (ack.conversationId && ack.conversationId !== local.conversationId) {
|
|
183
196
|
const from = local.conversationId; local.conversationId = ack.conversationId;
|
|
184
197
|
if (!isAggregate) state.lastRehome = { from, to: ack.conversationId }; // single-chat: cockpit must retarget
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest.appwrite.data.js": "sha384-cfiPqikpRrY3hJkSUIKese6/jJAW67EMm/RX4w3332onpNUyZn6zkWcxJm/wquUf",
|
|
4
4
|
"manifest.appwrite.presences.js": "sha384-JyVDWFT69b7Svq8J8p9tNWe2v9PZNQBY5UyhtOl1vnuHFAX0CRQ3MA9SiKq5wzNh",
|
|
5
5
|
"manifest.charts.js": "sha384-qQrjhWkIDi4oU5uQrpy8DdlMjY+gfiivBuX6mssNiFdkawgkVBvKneGgp+nd3PYJ",
|
|
6
|
-
"manifest.chat.js": "sha384-
|
|
6
|
+
"manifest.chat.js": "sha384-utfSgqos5ECoW/LJqFrm8jQRZ0LblP6AS7tEGZinH1X/IkYXAHpKlH+G2tYPIFQg",
|
|
7
7
|
"manifest.code.js": "sha384-aoQ4E26vrhNe/+tL7K0h90c8/0ies7e8oIR6Ay92he2X3dnWZ+OPcn2Dna8fmc+c",
|
|
8
8
|
"manifest.color.js": "sha384-6Rv3LxyTcZNjrhtayQfqRdCx0uSZ4BiEbgEI98I62eTvp8Aw7LBIoNJ0Je1oktwL",
|
|
9
9
|
"manifest.colorpicker.js": "sha384-ULdxH2/83Ly3E9DOX53TQqyy4WjSbfqLIBGVLEEFpYhwMP/cFrWujz83sWVzzsyt",
|