@atlaskit/jql-editor 5.0.7 → 5.0.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,13 @@
1
1
  # @atlaskit/jql-editor
2
2
 
3
+ ## 5.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#129314](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/129314)
8
+ [`439b876d25b73`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/439b876d25b73) -
9
+ Improved error logging for editor transactions.
10
+
3
11
  ## 5.0.7
4
12
 
5
13
  ### Patch Changes
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useJqlEditorAnalytics = void 0;
7
7
  var _jqlEditorCommon = require("@atlaskit/jql-editor-common");
8
8
  var useJqlEditorAnalytics = exports.useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
9
- return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.0.7", _jqlEditorCommon.ANALYTICS_CHANNEL);
9
+ return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "5.0.8", _jqlEditorCommon.ANALYTICS_CHANNEL);
10
10
  };
@@ -452,10 +452,25 @@ var actions = exports.actions = {
452
452
  query = _getState7.query,
453
453
  editorState = _getState7.editorState,
454
454
  editorView = _getState7.editorView,
455
- enableRichInlineNodes = _getState7.enableRichInlineNodes;
455
+ enableRichInlineNodes = _getState7.enableRichInlineNodes,
456
+ onDebugUnsafeMessage = _getState7.onDebugUnsafeMessage;
456
457
  var oldSelection = editorState.selection;
457
458
  var updatedQuery = (0, _documentText.getNodeText)(transaction.doc, 0, transaction.doc.content.size);
458
- var updatedEditorState = editorState.apply(transaction);
459
+ var updatedEditorState;
460
+ try {
461
+ updatedEditorState = editorState.apply(transaction);
462
+ } catch (error) {
463
+ // We've observed several errors in Splunk from this step but we're unsure how to reproduce it. It seems to be some type of
464
+ // race condition where the transaction is applied to the editor state but the editor state is being updated in another transaction.
465
+ if (error instanceof RangeError && editorView) {
466
+ var message = "Error occurred trying to update editor state with the message: ".concat(error.message);
467
+ (0, _util.sendDebugMessage)(message, editorView, editorState, onDebugUnsafeMessage, {
468
+ stack: error.stack,
469
+ transaction: JSON.stringify(transaction)
470
+ });
471
+ }
472
+ throw error;
473
+ }
459
474
 
460
475
  // Update state in our editor view
461
476
  if (editorView) {
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export const useJqlEditorAnalytics = analyticsSource => {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.7", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.8", ANALYTICS_CHANNEL);
4
4
  };
@@ -463,11 +463,26 @@ export const actions = {
463
463
  query,
464
464
  editorState,
465
465
  editorView,
466
- enableRichInlineNodes
466
+ enableRichInlineNodes,
467
+ onDebugUnsafeMessage
467
468
  } = getState();
468
469
  const oldSelection = editorState.selection;
469
470
  const updatedQuery = getNodeText(transaction.doc, 0, transaction.doc.content.size);
470
- const updatedEditorState = editorState.apply(transaction);
471
+ let updatedEditorState;
472
+ try {
473
+ updatedEditorState = editorState.apply(transaction);
474
+ } catch (error) {
475
+ // We've observed several errors in Splunk from this step but we're unsure how to reproduce it. It seems to be some type of
476
+ // race condition where the transaction is applied to the editor state but the editor state is being updated in another transaction.
477
+ if (error instanceof RangeError && editorView) {
478
+ const message = `Error occurred trying to update editor state with the message: ${error.message}`;
479
+ sendDebugMessage(message, editorView, editorState, onDebugUnsafeMessage, {
480
+ stack: error.stack,
481
+ transaction: JSON.stringify(transaction)
482
+ });
483
+ }
484
+ throw error;
485
+ }
471
486
 
472
487
  // Update state in our editor view
473
488
  if (editorView) {
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export var useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.7", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.0.8", ANALYTICS_CHANNEL);
4
4
  };
@@ -445,10 +445,25 @@ export var actions = {
445
445
  query = _getState7.query,
446
446
  editorState = _getState7.editorState,
447
447
  editorView = _getState7.editorView,
448
- enableRichInlineNodes = _getState7.enableRichInlineNodes;
448
+ enableRichInlineNodes = _getState7.enableRichInlineNodes,
449
+ onDebugUnsafeMessage = _getState7.onDebugUnsafeMessage;
449
450
  var oldSelection = editorState.selection;
450
451
  var updatedQuery = getNodeText(transaction.doc, 0, transaction.doc.content.size);
451
- var updatedEditorState = editorState.apply(transaction);
452
+ var updatedEditorState;
453
+ try {
454
+ updatedEditorState = editorState.apply(transaction);
455
+ } catch (error) {
456
+ // We've observed several errors in Splunk from this step but we're unsure how to reproduce it. It seems to be some type of
457
+ // race condition where the transaction is applied to the editor state but the editor state is being updated in another transaction.
458
+ if (error instanceof RangeError && editorView) {
459
+ var message = "Error occurred trying to update editor state with the message: ".concat(error.message);
460
+ sendDebugMessage(message, editorView, editorState, onDebugUnsafeMessage, {
461
+ stack: error.stack,
462
+ transaction: JSON.stringify(transaction)
463
+ });
464
+ }
465
+ throw error;
466
+ }
452
467
 
453
468
  // Update state in our editor view
454
469
  if (editorView) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/jql-editor",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "This package allows consumers to render an advanced JQL editor component to enable autocomplete-assisted authoring and validation of JQL queries.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -50,10 +50,10 @@
50
50
  "@atlaskit/jql-parser": "^2.0.0",
51
51
  "@atlaskit/legacy-custom-icons": "^0.22.0",
52
52
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
- "@atlaskit/primitives": "^14.1.0",
53
+ "@atlaskit/primitives": "^14.2.0",
54
54
  "@atlaskit/spinner": "^18.0.0",
55
55
  "@atlaskit/theme": "^18.0.0",
56
- "@atlaskit/tokens": "^4.4.0",
56
+ "@atlaskit/tokens": "^4.5.0",
57
57
  "@atlaskit/tooltip": "^20.0.0",
58
58
  "@babel/runtime": "^7.0.0",
59
59
  "@emotion/react": "^11.7.1",