aboutsummaryrefslogtreecommitdiff
path: root/src/server/websocket.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-07 14:03:46 -0500
committerbobzel <zzzman@gmail.com>2020-12-07 14:03:46 -0500
commitff791402919478bf153179a6629752f2066edc29 (patch)
tree31a97e7c2b0f8cdbc719aa871d80785147bcdeb9 /src/server/websocket.ts
parent74b5ef7cd5f91d4483a407585bca0f6b93883208 (diff)
fixed lists to allow multiple null-value entries & be able to edit in KeyValuePane. cleaned up a lot of stuff with animation frames and got working again. fixed previews of links to text selections to preview properly.
Diffstat (limited to 'src/server/websocket.ts')
-rw-r--r--src/server/websocket.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/websocket.ts b/src/server/websocket.ts
index 7d111f359..6850f0601 100644
--- a/src/server/websocket.ts
+++ b/src/server/websocket.ts
@@ -279,13 +279,13 @@ export namespace WebSocket {
const updatefield = Array.from(Object.keys(diff.diff.$set))[0];
const newListItems = diff.diff.$set[updatefield].fields;
const curList = (curListItems as any)?.fields?.[updatefield.replace("fields.", "")]?.fields.filter((item: any) => item !== undefined) || [];
- diff.diff.$set[updatefield].fields = [...curList, ...newListItems.filter((newItem: any) => newItem && !curList.some((curItem: any) => curItem.fieldId ? curItem.fieldId === newItem.fieldId : curItem.heading ? curItem.heading === newItem.heading : curItem === newItem))];
+ diff.diff.$set[updatefield].fields = [...curList, ...newListItems.filter((newItem: any) => newItem === null || !curList.some((curItem: any) => curItem.fieldId ? curItem.fieldId === newItem.fieldId : curItem.heading ? curItem.heading === newItem.heading : curItem === newItem))];
const sendBack = diff.diff.length !== diff.diff.$set[updatefield].fields.length;
delete diff.diff.length;
Database.Instance.update(diff.id, diff.diff,
() => {
if (sendBack) {
- console.log("RET BACK");
+ console.log("Warning: list modified during update. Composite list is being returned.");
const id = socket.id;
socket.id = "";
socket.broadcast.emit(MessageStore.UpdateField.Message, diff);