blixify-ui-web 1.1.20 → 1.1.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ef,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAoB1B,eAAO,MAAM,YAAY,mFA4qSvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ef,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAoB1B,eAAO,MAAM,YAAY,mFA6rSvB,CAAC"}
@@ -3348,9 +3348,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3348
3348
  var handleSubmit = function (isDraft) { return __awaiter(void 0, void 0, void 0, function () {
3349
3349
  var preComplete, res, updatedMarkdownData_1, uploadedData_2, uploadTypes_1, err_22;
3350
3350
  var _a;
3351
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3352
- return __generator(this, function (_m) {
3353
- switch (_m.label) {
3351
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3352
+ return __generator(this, function (_o) {
3353
+ switch (_o.label) {
3354
3354
  case 0:
3355
3355
  // INFO: re-entry guard — if a submit is already in-flight (double-click,
3356
3356
  // rapid Enter keypresses, or concurrent bareSaveOnTabChange calls), return
@@ -3359,9 +3359,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3359
3359
  if (isSubmittingRef.current)
3360
3360
  return [2 /*return*/];
3361
3361
  isSubmittingRef.current = true;
3362
- _m.label = 1;
3362
+ _o.label = 1;
3363
3363
  case 1:
3364
- _m.trys.push([1, 10, , 11]);
3364
+ _o.trys.push([1, 10, , 11]);
3365
3365
  setLoading(true);
3366
3366
  setModalVisible(true);
3367
3367
  preComplete = true;
@@ -3369,28 +3369,36 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3369
3369
  return [4 /*yield*/, props.bareSettings.bareUpdateHandlePreComplete(selectedData)];
3370
3370
  case 2:
3371
3371
  preComplete =
3372
- _m.sent();
3373
- _m.label = 3;
3372
+ _o.sent();
3373
+ _o.label = 3;
3374
3374
  case 3:
3375
3375
  if (!preComplete)
3376
3376
  throw "Error";
3377
3377
  if (!((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareUpdateHandleComplete)) return [3 /*break*/, 5];
3378
3378
  return [4 /*yield*/, props.bareSettings.bareUpdateHandleComplete(selectedData)];
3379
3379
  case 4:
3380
- _m.sent();
3380
+ _o.sent();
3381
3381
  return [3 /*break*/, 9];
3382
3382
  case 5: return [4 /*yield*/, handleSubmitData(undefined, undefined, undefined, undefined, undefined, undefined, isDraft)];
3383
3383
  case 6:
3384
- res = _m.sent();
3384
+ res = _o.sent();
3385
3385
  if (!res) return [3 /*break*/, 9];
3386
3386
  if (!((_d = props.bareSettings) === null || _d === void 0 ? void 0 : _d.bareUpdateHandlePostComplete)) return [3 /*break*/, 8];
3387
3387
  return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_a = {}, _a[serverId] = res, _a), selectedData))];
3388
3388
  case 7:
3389
- _m.sent();
3390
- _m.label = 8;
3389
+ _o.sent();
3390
+ _o.label = 8;
3391
3391
  case 8:
3392
3392
  handleCheckOfflineDataLength();
3393
3393
  if (isDraft) {
3394
+ // INFO: advance the baseline after a successful draft save so that
3395
+ // subsequent saves only diff against what was just persisted.
3396
+ // Without this, listObject edits saved in a previous draft would be
3397
+ // re-sent on every subsequent save (harmless but wasteful), and the
3398
+ // "skip write if nothing changed" short-circuit would never trigger.
3399
+ if ((_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareUpsertPartialUpdate) {
3400
+ loadedSelectedData.current = JSON.parse(JSON.stringify(selectedData));
3401
+ }
3394
3402
  updatedMarkdownData_1 = {};
3395
3403
  structure.forEach(function (eachAttribute) {
3396
3404
  var _a, _b;
@@ -3429,7 +3437,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3429
3437
  setSelectedData(function (prev) { return (__assign(__assign({}, prev), updatedMarkdownData_1)); });
3430
3438
  }
3431
3439
  if (props.id === "new" || !props.id) {
3432
- (_f = (_e = props.organise) === null || _e === void 0 ? void 0 : _e.handleNavigate) === null || _f === void 0 ? void 0 : _f.call(_e, "update", res, (_g = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.id) !== null && _g !== void 0 ? _g : "general");
3440
+ (_g = (_f = props.organise) === null || _f === void 0 ? void 0 : _f.handleNavigate) === null || _g === void 0 ? void 0 : _g.call(_f, "update", res, (_h = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.id) !== null && _h !== void 0 ? _h : "general");
3433
3441
  }
3434
3442
  setNotification({
3435
3443
  type: true,
@@ -3443,20 +3451,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3443
3451
  }
3444
3452
  else {
3445
3453
  if (selectedTab) {
3446
- (_j = (_h = props.organise) === null || _h === void 0 ? void 0 : _h.handleNavigate) === null || _j === void 0 ? void 0 : _j.call(_h, "read", res, selectedTab.id);
3454
+ (_k = (_j = props.organise) === null || _j === void 0 ? void 0 : _j.handleNavigate) === null || _k === void 0 ? void 0 : _k.call(_j, "read", res, selectedTab.id);
3447
3455
  }
3448
3456
  else
3449
- (_l = (_k = props.organise) === null || _k === void 0 ? void 0 : _k.handleNavigate) === null || _l === void 0 ? void 0 : _l.call(_k, "read", res, "general");
3457
+ (_m = (_l = props.organise) === null || _l === void 0 ? void 0 : _l.handleNavigate) === null || _m === void 0 ? void 0 : _m.call(_l, "read", res, "general");
3450
3458
  }
3451
3459
  }
3452
- _m.label = 9;
3460
+ _o.label = 9;
3453
3461
  case 9:
3454
3462
  setModalVisible(false);
3455
3463
  setLoading(false);
3456
3464
  isSubmittingRef.current = false;
3457
3465
  return [3 /*break*/, 11];
3458
3466
  case 10:
3459
- err_22 = _m.sent();
3467
+ err_22 = _o.sent();
3460
3468
  setModalVisible(false);
3461
3469
  setLoading(false);
3462
3470
  isSubmittingRef.current = false;
@@ -3489,7 +3497,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3489
3497
  setSelectedData(responseData.data);
3490
3498
  // INFO: stamp the load baseline so bareUpsertPartialUpdate can diff
3491
3499
  // against the original doc rather than the post-edit state.
3492
- loadedSelectedData.current = responseData.data;
3500
+ // Deep clone to prevent shared-reference mutations from making the
3501
+ // diff see no changes (e.g. listObject array pushes).
3502
+ loadedSelectedData.current = JSON.parse(JSON.stringify(responseData.data));
3493
3503
  if ((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareReadHandleData)
3494
3504
  props.bareSettings.bareReadHandleData(responseData.data);
3495
3505
  clonedReferencesOptions_1 = JSON.parse(JSON.stringify(referencesOptions));
@@ -3560,7 +3570,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3560
3570
  setSelectedData(newRespData);
3561
3571
  // INFO: stamp the load baseline so bareUpsertPartialUpdate can diff
3562
3572
  // against the original doc rather than the post-edit state.
3563
- loadedSelectedData.current = newRespData;
3573
+ // Deep clone to prevent shared-reference mutations from making the
3574
+ // diff see no changes (e.g. listObject array pushes).
3575
+ loadedSelectedData.current = JSON.parse(JSON.stringify(newRespData));
3564
3576
  if ((_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareReadHandleData)
3565
3577
  props.bareSettings.bareReadHandleData(newRespData);
3566
3578
  if ((props.type === "update" || props.type === "read") &&