@atlaskit/editor-core 203.2.7 → 203.2.8

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,14 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 203.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174977](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/174977)
8
+ [`d96316360ee1d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d96316360ee1d) -
9
+ Block stale transactions when the react editor view is unmounted
10
+ - Updated dependencies
11
+
3
12
  ## 203.2.7
4
13
 
5
14
  ### Patch Changes
@@ -252,14 +252,6 @@ function ReactEditorView(props) {
252
252
  // Initialise phase
253
253
  // Using constructor hook so we setup and dispatch analytics before anything else
254
254
  (0, _hooks.useConstructor)(function () {
255
- // Transaction dispatching is already enabled by default prior to
256
- // mounting, but we reset it here, just in case the editor view
257
- // instance is ever recycled (mounted again after unmounting) with
258
- // the same key.
259
- // Although storing mounted state is an anti-pattern in React,
260
- // we do so here so that we can intercept and abort asynchronous
261
- // ProseMirror transactions when a dismount is imminent.
262
- canDispatchTransactions.current = true;
263
255
  // This needs to be before initialising editorState because
264
256
  // we dispatch analytics events in plugin initialisation
265
257
  eventDispatcher.on(_analytics2.analyticsEventKey, handleAnalyticsEvent);
@@ -274,6 +266,24 @@ function ReactEditorView(props) {
274
266
  eventType: _analytics.EVENT_TYPE.UI
275
267
  });
276
268
  });
269
+ (0, _react.useLayoutEffect)(function () {
270
+ // Transaction dispatching is already enabled by default prior to
271
+ // mounting, but we reset it here, just in case the editor view
272
+ // instance is ever recycled (mounted again after unmounting) with
273
+ // the same key.
274
+ // AND since React 18 effects may run multiple times so we need to ensure
275
+ // this is reset so that transactions are still allowed.
276
+ // Although storing mounted state is an anti-pattern in React,
277
+ // we do so here so that we can intercept and abort asynchronous
278
+ // ProseMirror transactions when a dismount is imminent.
279
+ canDispatchTransactions.current = true;
280
+ return function () {
281
+ // We can ignore any transactions from this point onwards.
282
+ // This serves to avoid potential runtime exceptions which could arise
283
+ // from an async dispatched transaction after it's unmounted.
284
+ canDispatchTransactions.current = false;
285
+ };
286
+ }, []);
277
287
 
278
288
  // Cleanup
279
289
  (0, _react.useLayoutEffect)(function () {
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "203.2.7";
8
+ var version = exports.version = "203.2.8";
@@ -227,14 +227,6 @@ function ReactEditorView(props) {
227
227
  // Initialise phase
228
228
  // Using constructor hook so we setup and dispatch analytics before anything else
229
229
  useConstructor(() => {
230
- // Transaction dispatching is already enabled by default prior to
231
- // mounting, but we reset it here, just in case the editor view
232
- // instance is ever recycled (mounted again after unmounting) with
233
- // the same key.
234
- // Although storing mounted state is an anti-pattern in React,
235
- // we do so here so that we can intercept and abort asynchronous
236
- // ProseMirror transactions when a dismount is imminent.
237
- canDispatchTransactions.current = true;
238
230
  // This needs to be before initialising editorState because
239
231
  // we dispatch analytics events in plugin initialisation
240
232
  eventDispatcher.on(analyticsEventKey, handleAnalyticsEvent);
@@ -249,6 +241,24 @@ function ReactEditorView(props) {
249
241
  eventType: EVENT_TYPE.UI
250
242
  });
251
243
  });
244
+ useLayoutEffect(() => {
245
+ // Transaction dispatching is already enabled by default prior to
246
+ // mounting, but we reset it here, just in case the editor view
247
+ // instance is ever recycled (mounted again after unmounting) with
248
+ // the same key.
249
+ // AND since React 18 effects may run multiple times so we need to ensure
250
+ // this is reset so that transactions are still allowed.
251
+ // Although storing mounted state is an anti-pattern in React,
252
+ // we do so here so that we can intercept and abort asynchronous
253
+ // ProseMirror transactions when a dismount is imminent.
254
+ canDispatchTransactions.current = true;
255
+ return () => {
256
+ // We can ignore any transactions from this point onwards.
257
+ // This serves to avoid potential runtime exceptions which could arise
258
+ // from an async dispatched transaction after it's unmounted.
259
+ canDispatchTransactions.current = false;
260
+ };
261
+ }, []);
252
262
 
253
263
  // Cleanup
254
264
  useLayoutEffect(() => {
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "203.2.7";
2
+ export const version = "203.2.8";
@@ -242,14 +242,6 @@ function ReactEditorView(props) {
242
242
  // Initialise phase
243
243
  // Using constructor hook so we setup and dispatch analytics before anything else
244
244
  useConstructor(function () {
245
- // Transaction dispatching is already enabled by default prior to
246
- // mounting, but we reset it here, just in case the editor view
247
- // instance is ever recycled (mounted again after unmounting) with
248
- // the same key.
249
- // Although storing mounted state is an anti-pattern in React,
250
- // we do so here so that we can intercept and abort asynchronous
251
- // ProseMirror transactions when a dismount is imminent.
252
- canDispatchTransactions.current = true;
253
245
  // This needs to be before initialising editorState because
254
246
  // we dispatch analytics events in plugin initialisation
255
247
  eventDispatcher.on(analyticsEventKey, handleAnalyticsEvent);
@@ -264,6 +256,24 @@ function ReactEditorView(props) {
264
256
  eventType: EVENT_TYPE.UI
265
257
  });
266
258
  });
259
+ useLayoutEffect(function () {
260
+ // Transaction dispatching is already enabled by default prior to
261
+ // mounting, but we reset it here, just in case the editor view
262
+ // instance is ever recycled (mounted again after unmounting) with
263
+ // the same key.
264
+ // AND since React 18 effects may run multiple times so we need to ensure
265
+ // this is reset so that transactions are still allowed.
266
+ // Although storing mounted state is an anti-pattern in React,
267
+ // we do so here so that we can intercept and abort asynchronous
268
+ // ProseMirror transactions when a dismount is imminent.
269
+ canDispatchTransactions.current = true;
270
+ return function () {
271
+ // We can ignore any transactions from this point onwards.
272
+ // This serves to avoid potential runtime exceptions which could arise
273
+ // from an async dispatched transaction after it's unmounted.
274
+ canDispatchTransactions.current = false;
275
+ };
276
+ }, []);
267
277
 
268
278
  // Cleanup
269
279
  useLayoutEffect(function () {
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "203.2.7";
2
+ export var version = "203.2.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "203.2.7",
3
+ "version": "203.2.8",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/analytics-next": "^10.2.0",
44
44
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
45
45
  "@atlaskit/button": "^20.3.0",
46
- "@atlaskit/editor-common": "^96.3.0",
46
+ "@atlaskit/editor-common": "^96.4.0",
47
47
  "@atlaskit/editor-json-transformer": "^8.21.0",
48
48
  "@atlaskit/editor-plugin-quick-insert": "1.8.0",
49
49
  "@atlaskit/editor-plugins": "^5.8.0",
@@ -83,7 +83,7 @@
83
83
  "@af/visual-regression": "*",
84
84
  "@atlaskit/adf-utils": "^19.14.0",
85
85
  "@atlaskit/analytics-listeners": "^8.13.0",
86
- "@atlaskit/collab-provider": "10.2.1",
86
+ "@atlaskit/collab-provider": "10.2.2",
87
87
  "@atlaskit/editor-plugin-annotation": "1.26.2",
88
88
  "@atlaskit/editor-plugin-card": "^4.5.0",
89
89
  "@atlaskit/editor-plugin-list": "^3.9.0",
@@ -103,7 +103,7 @@
103
103
  "@atlaskit/visual-regression": "*",
104
104
  "@atlassian/adf-schema-json": "^1.22.0",
105
105
  "@atlassian/feature-flags-test-utils": "*",
106
- "@atlassian/search-provider": "3.0.6",
106
+ "@atlassian/search-provider": "3.0.7",
107
107
  "@emotion/jest": "^11.8.0",
108
108
  "@storybook/addon-knobs": "^6.4.0",
109
109
  "@testing-library/react": "^12.1.5",