cry-synced-db-client 2.0.4 → 2.0.5

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/index.js CHANGED
@@ -4878,7 +4878,7 @@ var ServerUpdateHandler = class {
4878
4878
  }
4879
4879
  const pendingChange = this.deps.getPendingChange(collection, serverDelta._id);
4880
4880
  if (pendingChange) {
4881
- const newFields = this.getNewFieldsFromServer(localItem, serverDelta);
4881
+ const newFields = this.getNewFieldsFromServer(pendingChange.data, serverDelta);
4882
4882
  if (Object.keys(newFields).length > 0) {
4883
4883
  Object.assign(pendingChange.data, newFields);
4884
4884
  }
@@ -4975,10 +4975,26 @@ var ServerUpdateHandler = class {
4975
4975
  }
4976
4976
  return local;
4977
4977
  }
4978
- getNewFieldsFromServer(local, server) {
4978
+ /**
4979
+ * Fields from an incoming server delta that our OWN in-flight pending
4980
+ * change doesn't already touch — safe to backfill into it so a later
4981
+ * merge doesn't clobber a concurrent server-side edit to an unrelated
4982
+ * field.
4983
+ *
4984
+ * Checked against `pendingChange.data`'s own keys (not the dexie-persisted
4985
+ * `local` snapshot): a field we're deliberately clearing shows up as
4986
+ * `undefined` on `local` too (once `applyObjDiff` deletes it), which is
4987
+ * indistinguishable from "local never knew about this field" if you test
4988
+ * `local[key] === undefined`. That conflation let a slower, older echo
4989
+ * (e.g. a lock-write's own confirmation arriving after we've already
4990
+ * locally reverted it) resurrect a field our pending change had just
4991
+ * unset — reproduced with izdajRacun.vue's sedajObdeluje lock/unlock race
4992
+ * (2026-07-14).
4993
+ */
4994
+ getNewFieldsFromServer(pendingData, server) {
4979
4995
  const newFields = {};
4980
4996
  for (const key of Object.keys(server)) {
4981
- if (key !== "_id" && key !== "_dirty" && local[key] === void 0) {
4997
+ if (key !== "_id" && key !== "_dirty" && !Object.prototype.hasOwnProperty.call(pendingData, key)) {
4982
4998
  newFields[key] = server[key];
4983
4999
  }
4984
5000
  }
@@ -81,6 +81,22 @@ export declare class ServerUpdateHandler implements I_ServerUpdateHandler {
81
81
  private timestampsEqual;
82
82
  /** @mutates local — mutira vhodni objekt namesto kopiranja */
83
83
  private mergeLocalWithDelta;
84
+ /**
85
+ * Fields from an incoming server delta that our OWN in-flight pending
86
+ * change doesn't already touch — safe to backfill into it so a later
87
+ * merge doesn't clobber a concurrent server-side edit to an unrelated
88
+ * field.
89
+ *
90
+ * Checked against `pendingChange.data`'s own keys (not the dexie-persisted
91
+ * `local` snapshot): a field we're deliberately clearing shows up as
92
+ * `undefined` on `local` too (once `applyObjDiff` deletes it), which is
93
+ * indistinguishable from "local never knew about this field" if you test
94
+ * `local[key] === undefined`. That conflation let a slower, older echo
95
+ * (e.g. a lock-write's own confirmation arriving after we've already
96
+ * locally reverted it) resurrect a field our pending change had just
97
+ * unset — reproduced with izdajRacun.vue's sedajObdeluje lock/unlock race
98
+ * (2026-07-14).
99
+ */
84
100
  private getNewFieldsFromServer;
85
101
  private callOnWsNotification;
86
102
  private callOnEbusNotificationReceived;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",