@atlaskit/editor-synced-block-provider 3.14.3 → 3.14.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 3.14.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5ec143ea91476`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5ec143ea91476) -
8
+ Do not re-convert already converted timestamps
9
+ - [`aa5302b457078`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa5302b457078) -
10
+ [ux] EDITOR-4763 Ensure initial source sync block data are always registered
11
+ - Updated dependencies
12
+
3
13
  ## 3.14.3
4
14
 
5
15
  ### Patch Changes
@@ -102,9 +102,7 @@ var convertToSyncBlockData = exports.convertToSyncBlockData = function convertTo
102
102
  var createdAt;
103
103
  if (data.createdAt !== undefined && data.createdAt !== null) {
104
104
  try {
105
- // BE returns microseconds, convert to milliseconds
106
- // BE should fix this in the future
107
- createdAt = new Date(data.createdAt / 1000).toISOString();
105
+ createdAt = new Date(data.createdAt).toISOString();
108
106
  } catch (_unused) {
109
107
  // fallback to undefined
110
108
  // as we don't want to block the whole process due to invalid date
@@ -282,7 +282,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
282
282
  */
283
283
  }, {
284
284
  key: "createBodiedSyncBlockNode",
285
- value: function createBodiedSyncBlockNode(attrs) {
285
+ value: function createBodiedSyncBlockNode(attrs, nodeData) {
286
286
  var _this4 = this;
287
287
  try {
288
288
  var _this$createExperienc;
@@ -304,6 +304,12 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
304
304
  var _this4$createExperien;
305
305
  (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.success();
306
306
  }
307
+
308
+ // Update the sync block data with the node data if it is provided
309
+ // to avoid any race conditions where the data could be missed during a render operation
310
+ if (nodeData) {
311
+ _this4.updateSyncBlockData(nodeData);
312
+ }
307
313
  } else {
308
314
  var _this4$fireAnalyticsE;
309
315
  _this4.commitPendingCreation(false);
@@ -556,7 +562,7 @@ var SourceSyncBlockStoreManager = exports.SourceSyncBlockStoreManager = /*#__PUR
556
562
  if (!sourceInfo) {
557
563
  var _this6$fetchSourceInf;
558
564
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
559
- reason: "No source info returned"
565
+ reason: 'No source info returned'
560
566
  });
561
567
  } else {
562
568
  var _this6$fetchSourceInf2;
@@ -85,9 +85,7 @@ export const convertToSyncBlockData = (data, resourceId) => {
85
85
  let createdAt;
86
86
  if (data.createdAt !== undefined && data.createdAt !== null) {
87
87
  try {
88
- // BE returns microseconds, convert to milliseconds
89
- // BE should fix this in the future
90
- createdAt = new Date(data.createdAt / 1000).toISOString();
88
+ createdAt = new Date(data.createdAt).toISOString();
91
89
  } catch {
92
90
  // fallback to undefined
93
91
  // as we don't want to block the whole process due to invalid date
@@ -214,7 +214,7 @@ export class SourceSyncBlockStoreManager {
214
214
  * Create a bodiedSyncBlock node with empty content to backend
215
215
  * @param attrs attributes Ids of the node
216
216
  */
217
- createBodiedSyncBlockNode(attrs) {
217
+ createBodiedSyncBlockNode(attrs, nodeData) {
218
218
  try {
219
219
  var _this$createExperienc;
220
220
  if (!this.dataProvider) {
@@ -237,6 +237,12 @@ export class SourceSyncBlockStoreManager {
237
237
  var _this$createExperienc2;
238
238
  (_this$createExperienc2 = this.createExperience) === null || _this$createExperienc2 === void 0 ? void 0 : _this$createExperienc2.success();
239
239
  }
240
+
241
+ // Update the sync block data with the node data if it is provided
242
+ // to avoid any race conditions where the data could be missed during a render operation
243
+ if (nodeData) {
244
+ this.updateSyncBlockData(nodeData);
245
+ }
240
246
  } else {
241
247
  var _this$fireAnalyticsEv7;
242
248
  this.commitPendingCreation(false);
@@ -406,7 +412,7 @@ export class SourceSyncBlockStoreManager {
406
412
  if (!sourceInfo) {
407
413
  var _this$fetchSourceInfo2;
408
414
  (_this$fetchSourceInfo2 = this.fetchSourceInfoExperience) === null || _this$fetchSourceInfo2 === void 0 ? void 0 : _this$fetchSourceInfo2.failure({
409
- reason: "No source info returned"
415
+ reason: 'No source info returned'
410
416
  });
411
417
  } else {
412
418
  var _this$fetchSourceInfo3;
@@ -96,9 +96,7 @@ export var convertToSyncBlockData = function convertToSyncBlockData(data, resour
96
96
  var createdAt;
97
97
  if (data.createdAt !== undefined && data.createdAt !== null) {
98
98
  try {
99
- // BE returns microseconds, convert to milliseconds
100
- // BE should fix this in the future
101
- createdAt = new Date(data.createdAt / 1000).toISOString();
99
+ createdAt = new Date(data.createdAt).toISOString();
102
100
  } catch (_unused) {
103
101
  // fallback to undefined
104
102
  // as we don't want to block the whole process due to invalid date
@@ -275,7 +275,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
275
275
  */
276
276
  }, {
277
277
  key: "createBodiedSyncBlockNode",
278
- value: function createBodiedSyncBlockNode(attrs) {
278
+ value: function createBodiedSyncBlockNode(attrs, nodeData) {
279
279
  var _this4 = this;
280
280
  try {
281
281
  var _this$createExperienc;
@@ -297,6 +297,12 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
297
297
  var _this4$createExperien;
298
298
  (_this4$createExperien = _this4.createExperience) === null || _this4$createExperien === void 0 || _this4$createExperien.success();
299
299
  }
300
+
301
+ // Update the sync block data with the node data if it is provided
302
+ // to avoid any race conditions where the data could be missed during a render operation
303
+ if (nodeData) {
304
+ _this4.updateSyncBlockData(nodeData);
305
+ }
300
306
  } else {
301
307
  var _this4$fireAnalyticsE;
302
308
  _this4.commitPendingCreation(false);
@@ -549,7 +555,7 @@ export var SourceSyncBlockStoreManager = /*#__PURE__*/function () {
549
555
  if (!sourceInfo) {
550
556
  var _this6$fetchSourceInf;
551
557
  (_this6$fetchSourceInf = _this6.fetchSourceInfoExperience) === null || _this6$fetchSourceInf === void 0 || _this6$fetchSourceInf.failure({
552
- reason: "No source info returned"
558
+ reason: 'No source info returned'
553
559
  });
554
560
  } else {
555
561
  var _this6$fetchSourceInf2;
@@ -58,7 +58,7 @@ export declare class SourceSyncBlockStoreManager {
58
58
  * Create a bodiedSyncBlock node with empty content to backend
59
59
  * @param attrs attributes Ids of the node
60
60
  */
61
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
61
+ createBodiedSyncBlockNode(attrs: SyncBlockAttrs, nodeData?: PMNode): void;
62
62
  private setPendingDeletion;
63
63
  private delete;
64
64
  isRetryingDeletion(): boolean;
@@ -58,7 +58,7 @@ export declare class SourceSyncBlockStoreManager {
58
58
  * Create a bodiedSyncBlock node with empty content to backend
59
59
  * @param attrs attributes Ids of the node
60
60
  */
61
- createBodiedSyncBlockNode(attrs: SyncBlockAttrs): void;
61
+ createBodiedSyncBlockNode(attrs: SyncBlockAttrs, nodeData?: PMNode): void;
62
62
  private setPendingDeletion;
63
63
  private delete;
64
64
  isRetryingDeletion(): boolean;
package/package.json CHANGED
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "name": "@atlaskit/editor-synced-block-provider",
81
- "version": "3.14.3",
81
+ "version": "3.14.4",
82
82
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
83
83
  "author": "Atlassian Pty Ltd",
84
84
  "license": "Apache-2.0",