@atlaskit/editor-plugin-card 33.0.5 → 34.0.1

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/nodeviews/blockCard.js +11 -2
  3. package/dist/cjs/nodeviews/inlineCardBase.js +16 -2
  4. package/dist/cjs/nodeviews/inlineCardWithAwareness.js +22 -6
  5. package/dist/cjs/pm-plugins/main.js +8 -1
  6. package/dist/cjs/pm-plugins/reducers.js +23 -4
  7. package/dist/cjs/ui/DatasourceAppearanceButton.js +2 -2
  8. package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +5 -5
  9. package/dist/cjs/ui/EditToolbarButton/index.js +5 -5
  10. package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -2
  11. package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +2 -2
  12. package/dist/cjs/ui/InlineCardOverlay/index.js +4 -0
  13. package/dist/cjs/ui/OpenPreviewButton/index.js +7 -5
  14. package/dist/cjs/ui/PasteDisplayAsMenu.js +6 -4
  15. package/dist/es2019/nodeviews/blockCard.js +11 -2
  16. package/dist/es2019/nodeviews/inlineCardBase.js +16 -2
  17. package/dist/es2019/nodeviews/inlineCardWithAwareness.js +19 -3
  18. package/dist/es2019/pm-plugins/main.js +8 -1
  19. package/dist/es2019/pm-plugins/reducers.js +24 -2
  20. package/dist/es2019/ui/DatasourceAppearanceButton.js +1 -1
  21. package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
  22. package/dist/es2019/ui/EditToolbarButton/index.js +1 -1
  23. package/dist/es2019/ui/HyperlinkToolbarAppearance.js +1 -1
  24. package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +1 -1
  25. package/dist/es2019/ui/InlineCardOverlay/index.js +4 -0
  26. package/dist/es2019/ui/OpenPreviewButton/index.js +3 -1
  27. package/dist/es2019/ui/PasteDisplayAsMenu.js +3 -1
  28. package/dist/esm/nodeviews/blockCard.js +11 -2
  29. package/dist/esm/nodeviews/inlineCardBase.js +16 -2
  30. package/dist/esm/nodeviews/inlineCardWithAwareness.js +23 -7
  31. package/dist/esm/pm-plugins/main.js +8 -1
  32. package/dist/esm/pm-plugins/reducers.js +23 -4
  33. package/dist/esm/ui/DatasourceAppearanceButton.js +1 -1
  34. package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
  35. package/dist/esm/ui/EditToolbarButton/index.js +1 -1
  36. package/dist/esm/ui/HyperlinkToolbarAppearance.js +1 -1
  37. package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +1 -1
  38. package/dist/esm/ui/InlineCardOverlay/index.js +4 -0
  39. package/dist/esm/ui/OpenPreviewButton/index.js +3 -1
  40. package/dist/esm/ui/PasteDisplayAsMenu.js +3 -1
  41. package/dist/types/nodeviews/blockCard.d.ts +1 -0
  42. package/dist/types/pm-plugins/util/state.d.ts +1 -0
  43. package/dist/types/types/index.d.ts +1 -0
  44. package/dist/types/ui/PreAuthValuePropositionModal.d.ts +1 -1
  45. package/package.json +23 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 34.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fc2f6ea92bf86`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fc2f6ea92bf86) -
8
+ Behind `platform_editor_reduce_memory_leaks`: stop retaining deleted inline and block cards.
9
+ Pending `registerCard` animation frames are cancelled on unmount, resolve-request cancel callbacks
10
+ are dropped once they fire, the `removeOverlay` callback is cleared when its card is removed and
11
+ no longer closes over the node view scope, and the inline card overlay cancels its resize debounce
12
+ on cleanup.
13
+ - Updated dependencies
14
+
15
+ ## 34.0.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 33.0.5
4
22
 
5
23
  ### Patch Changes
@@ -51,7 +51,7 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
51
51
 
52
52
  // don't dispatch immediately since we might be in the middle of
53
53
  // rendering a nodeview
54
- (0, _rafSchd.default)(function () {
54
+ var scheduleRegisterCard = (0, _rafSchd.default)(function () {
55
55
  var pos = getPos();
56
56
  if (typeof pos !== 'number') {
57
57
  return;
@@ -62,7 +62,11 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
62
62
  pos: pos,
63
63
  id: _this.props.id
64
64
  })(view.state.tr));
65
- })();
65
+ });
66
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
67
+ _this.pendingRegisterCard = scheduleRegisterCard;
68
+ }
69
+ scheduleRegisterCard();
66
70
  });
67
71
  (0, _defineProperty2.default)(_this, "removeCardDispatched", false);
68
72
  (0, _defineProperty2.default)(_this, "gapCursorSpan", function () {
@@ -94,6 +98,11 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
94
98
  return (0, _createClass2.default)(BlockCardComponent, [{
95
99
  key: "componentWillUnmount",
96
100
  value: function componentWillUnmount() {
101
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
102
+ var _this$pendingRegister;
103
+ (_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 || _this$pendingRegister.cancel();
104
+ this.pendingRegisterCard = undefined;
105
+ }
97
106
  this.removeCard();
98
107
  }
99
108
  }, {
@@ -43,6 +43,16 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
43
43
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
44
44
  var refId = (0, _react.useRef)((0, _uuid.v4)());
45
45
  var removeCardDispatched = (0, _react.useRef)(false);
46
+ var pendingRegisterCard = (0, _react.useRef)(null);
47
+ (0, _react.useEffect)(function () {
48
+ return function () {
49
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
50
+ var _pendingRegisterCard$;
51
+ (_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 || _pendingRegisterCard$.cancel();
52
+ pendingRegisterCard.current = null;
53
+ }
54
+ };
55
+ }, []);
46
56
  var _ref2 = (cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {},
47
57
  getSmartlinkState = _ref2.getState;
48
58
  var cardState = getSmartlinkState === null || getSmartlinkState === void 0 ? void 0 : getSmartlinkState()[url || ''];
@@ -74,7 +84,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
74
84
  url = data.url;
75
85
  // don't dispatch immediately since we might be in the middle of
76
86
  // rendering a nodeview
77
- (0, _rafSchd.default)(function () {
87
+ var scheduleRegisterCard = (0, _rafSchd.default)(function () {
78
88
  // prosemirror-bump-fix
79
89
  var pos = getPos();
80
90
  if (typeof pos !== 'number') {
@@ -89,7 +99,11 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
89
99
  })(tr);
90
100
  onRes === null || onRes === void 0 || onRes(tr, title);
91
101
  view.dispatch(tr);
92
- })();
102
+ });
103
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
104
+ pendingRegisterCard.current = scheduleRegisterCard;
105
+ }
106
+ scheduleRegisterCard();
93
107
  }, [getPos, view, onRes]);
94
108
  var onError = (0, _react.useCallback)(function (data) {
95
109
  var url = data.url,
@@ -14,6 +14,7 @@ var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useShar
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _extractSmartLinkEmbed = require("@atlaskit/link-extractors/extract-smart-link-embed");
16
16
  var _isWithinPreviewPanelIframe = require("@atlaskit/linking-common/utils/is-within-preview-panel-iframe");
17
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
17
18
  var _smartCard = require("@atlaskit/smart-card");
18
19
  var _useSmartLinkDestinationUrl = require("@atlaskit/smart-card/hook/use-smart-link-destination-url");
19
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -23,6 +24,14 @@ var _AwarenessWrapper = require("../ui/AwarenessWrapper");
23
24
  var _PreviewInvoker = require("../ui/preview/PreviewInvoker");
24
25
  var _inlineCardBase = require("./inlineCardBase");
25
26
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
27
+ // Module scope so the stored callback's closure chain cannot reach the
28
+ // component scope (getPos, node, view) via V8 context sharing.
29
+ var createRemoveOverlay = function createRemoveOverlay(setIsInsertedRef) {
30
+ return function () {
31
+ var _setIsInsertedRef$cur;
32
+ return (_setIsInsertedRef$cur = setIsInsertedRef.current) === null || _setIsInsertedRef$cur === void 0 ? void 0 : _setIsInsertedRef$cur.call(setIsInsertedRef, false);
33
+ };
34
+ };
26
35
  var selector = function selector(states) {
27
36
  var _states$editorViewMod, _states$selectionStat;
28
37
  return {
@@ -54,6 +63,14 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
54
63
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
55
64
  isInserted = _useState4[0],
56
65
  setIsInserted = _useState4[1];
66
+ var setIsInsertedRef = (0, _react.useRef)(setIsInserted);
67
+ (0, _react.useEffect)(function () {
68
+ return function () {
69
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
70
+ setIsInsertedRef.current = undefined;
71
+ }
72
+ };
73
+ }, []);
57
74
  var _useState5 = (0, _react.useState)(false),
58
75
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
59
76
  isResolvedViewRendered = _useState6[0],
@@ -62,14 +79,13 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
62
79
  var destinationUrl = (0, _useSmartLinkDestinationUrl.useSmartLinkDestinationUrl)(node.attrs.url);
63
80
  var onResolve = (0, _react.useCallback)(function (tr, title) {
64
81
  var metadata = tr.getMeta(_pluginKey.pluginKey);
82
+ var removeOverlay = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? createRemoveOverlay(setIsInsertedRef) : function () {
83
+ return setIsInserted(false);
84
+ };
65
85
  if (metadata && metadata.type === 'REGISTER') {
66
- (0, _actions.registerRemoveOverlay)(function () {
67
- return setIsInserted(false);
68
- }, metadata.info)(tr);
86
+ (0, _actions.registerRemoveOverlay)(removeOverlay, metadata.info)(tr);
69
87
  } else {
70
- (0, _actions.registerRemoveOverlay)(function () {
71
- return setIsInserted(false);
72
- })(tr);
88
+ (0, _actions.registerRemoveOverlay)(removeOverlay)(tr);
73
89
  }
74
90
  if (title) {
75
91
  setIsResolvedViewRendered(true);
@@ -15,6 +15,7 @@ var _smartCard = require("@atlaskit/editor-common/styles/smartCard");
15
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
16
  var _utils = require("@atlaskit/editor-prosemirror/utils");
17
17
  var _constants = require("@atlaskit/linking-common/constants");
18
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
18
19
  var _blockCard = require("../nodeviews/blockCard");
19
20
  var _embedCard = require("../nodeviews/embedCard");
20
21
  var _inlineCard = require("../nodeviews/inlineCard");
@@ -239,7 +240,13 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
239
240
  */
240
241
  var invoke = (0, _rafSchd.default)(function () {
241
242
  var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _currentState$embedCa;
242
- return (0, _resolve.resolveWithProvider)(view, _provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 || (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
243
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
244
+ var index = rafCancellationCallbacks.indexOf(invoke.cancel);
245
+ if (index !== -1) {
246
+ rafCancellationCallbacks.splice(index, 1);
247
+ }
248
+ }
249
+ (0, _resolve.resolveWithProvider)(view, _provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 || (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
243
250
  });
244
251
  rafCancellationCallbacks.push(invoke.cancel);
245
252
  invoke();
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
11
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -36,10 +37,18 @@ var register = function register(state, action) {
36
37
  });
37
38
  };
38
39
  var removeCard = function removeCard(state, action) {
40
+ var cards = state.cards.filter(function (card) {
41
+ return card.id !== action.info.id;
42
+ });
43
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') && state.removeOverlayCardId !== undefined && state.removeOverlayCardId === action.info.id) {
44
+ return _objectSpread(_objectSpread({}, state), {}, {
45
+ cards: cards,
46
+ removeOverlay: undefined,
47
+ removeOverlayCardId: undefined
48
+ });
49
+ }
39
50
  return _objectSpread(_objectSpread({}, state), {}, {
40
- cards: state.cards.filter(function (card) {
41
- return card.id !== action.info.id;
42
- })
51
+ cards: cards
43
52
  });
44
53
  };
45
54
  var setProvider = function setProvider(state, action) {
@@ -91,18 +100,28 @@ var hideDatasourceModal = function hideDatasourceModal(state) {
91
100
  });
92
101
  };
93
102
  var clearOverlayCandidate = function clearOverlayCandidate(state) {
103
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
104
+ return _objectSpread(_objectSpread({}, state), {}, {
105
+ overlayCandidatePosition: undefined,
106
+ removeOverlay: undefined,
107
+ removeOverlayCardId: undefined
108
+ });
109
+ }
94
110
  return _objectSpread(_objectSpread({}, state), {}, {
95
111
  overlayCandidatePosition: undefined
96
112
  });
97
113
  };
98
114
  var registerRemoveOverlayOnInsertedLink = function registerRemoveOverlayOnInsertedLink(state, action) {
115
+ var _action$info2;
99
116
  return _objectSpread(_objectSpread({}, state), {}, {
100
117
  cards: action.info ? state.cards.filter(function (card) {
101
118
  var _action$info;
102
119
  return card.pos !== ((_action$info = action.info) === null || _action$info === void 0 ? void 0 : _action$info.pos);
103
120
  }).concat(action.info) : state.cards,
104
121
  removeOverlay: action.callback
105
- });
122
+ }, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? {
123
+ removeOverlayCardId: (_action$info2 = action.info) === null || _action$info2 === void 0 ? void 0 : _action$info2.id
124
+ } : {});
106
125
  };
107
126
  var setDatasourceStash = function setDatasourceStash(state, action) {
108
127
  return _objectSpread(_objectSpread({}, state), {}, {
@@ -13,7 +13,7 @@ var _datasource = require("@atlaskit/editor-common/utils/datasource");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _schema = require("@atlaskit/link-datasource/utils/schema");
15
15
  var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
16
- var _compiled = require("@atlaskit/primitives/compiled");
16
+ var _flex = require("@atlaskit/primitives/compiled/flex");
17
17
  var _doc = require("../pm-plugins/doc");
18
18
  var _pluginKey = require("../pm-plugins/plugin-key");
19
19
  var _DatasourceIcon = require("./DatasourceIcon");
@@ -95,7 +95,7 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
95
95
  }
96
96
  }
97
97
  var buttonLabel = intl.formatMessage(_card.messages.datasourceAppearanceTitle);
98
- return (0, _react2.jsx)(_compiled.Flex, null, (0, _react2.jsx)(_Button.default, {
98
+ return (0, _react2.jsx)(_flex.Flex, null, (0, _react2.jsx)(_Button.default, {
99
99
  css: buttonStyles,
100
100
  title: buttonLabel,
101
101
  icon: (0, _react2.jsx)(_DatasourceIcon.DatasourceIcon, {
@@ -18,7 +18,7 @@ var _DropdownContainer = require("@atlaskit/editor-common/ui-menu/DropdownContai
18
18
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
19
19
  var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
20
20
  var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
21
- var _compiled = require("@atlaskit/primitives/compiled");
21
+ var _flex = require("@atlaskit/primitives/compiled/flex");
22
22
  var _utils = require("../../pm-plugins/utils");
23
23
  var _editDatasourceAction = require("../editDatasourceAction");
24
24
  /**
@@ -73,7 +73,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
73
73
  switch (editVariant) {
74
74
  case 'edit-link':
75
75
  {
76
- return (0, _react2.jsx)(_compiled.Flex, {
76
+ return (0, _react2.jsx)(_flex.Flex, {
77
77
  gap: "space.050"
78
78
  }, (0, _react2.jsx)(_Button.default, {
79
79
  testId: "edit-link",
@@ -91,7 +91,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
91
91
  }
92
92
  case 'edit-datasource':
93
93
  {
94
- return (0, _react2.jsx)(_compiled.Flex, {
94
+ return (0, _react2.jsx)(_flex.Flex, {
95
95
  gap: "space.050"
96
96
  }, (0, _react2.jsx)(_Button.default, {
97
97
  testId: "edit-datasource",
@@ -107,7 +107,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
107
107
  }
108
108
  case 'edit-dropdown':
109
109
  {
110
- var trigger = (0, _react2.jsx)(_compiled.Flex, {
110
+ var trigger = (0, _react2.jsx)(_flex.Flex, {
111
111
  gap: "space.050"
112
112
  }, (0, _react2.jsx)(_Button.default, {
113
113
  testId: "edit-dropdown-trigger",
@@ -128,7 +128,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
128
128
  , _card.messages.editDropdownTriggerTitle)), !areAnyNewToolbarFlagsEnabled && (0, _react2.jsx)(_Separator.default, {
129
129
  areAnyNewToolbarFlagsEnabled: false
130
130
  }));
131
- return (0, _react2.jsx)(_compiled.Flex, {
131
+ return (0, _react2.jsx)(_flex.Flex, {
132
132
  ref: containerRef
133
133
  }, (0, _react2.jsx)(_DropdownContainer.DropdownContainer, {
134
134
  mountTo: containerRef.current,
@@ -19,7 +19,7 @@ var _DropdownContainer = require("@atlaskit/editor-common/ui-menu/DropdownContai
19
19
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
20
20
  var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
21
21
  var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
22
- var _compiled = require("@atlaskit/primitives/compiled");
22
+ var _flex = require("@atlaskit/primitives/compiled/flex");
23
23
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
24
24
  var _utils = require("../../pm-plugins/utils");
25
25
  var _editDatasourceAction = require("../editDatasourceAction");
@@ -100,7 +100,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
100
100
  switch (editVariant) {
101
101
  case 'edit-link':
102
102
  {
103
- return (0, _react2.jsx)(_compiled.Flex, {
103
+ return (0, _react2.jsx)(_flex.Flex, {
104
104
  gap: "space.050"
105
105
  }, (0, _react2.jsx)(_Button.default, {
106
106
  testId: "edit-link",
@@ -115,7 +115,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
115
115
  }
116
116
  case 'edit-datasource':
117
117
  {
118
- return (0, _react2.jsx)(_compiled.Flex, {
118
+ return (0, _react2.jsx)(_flex.Flex, {
119
119
  gap: "space.050"
120
120
  }, (0, _react2.jsx)(_Button.default, {
121
121
  testId: "edit-datasource",
@@ -131,7 +131,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
131
131
  }
132
132
  case 'edit-dropdown':
133
133
  {
134
- var trigger = (0, _react2.jsx)(_compiled.Flex, {
134
+ var trigger = (0, _react2.jsx)(_flex.Flex, {
135
135
  gap: "space.050"
136
136
  }, (0, _react2.jsx)(_Button.default, {
137
137
  testId: "edit-dropdown-trigger",
@@ -152,7 +152,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
152
152
  , _card.messages.editDropdownTriggerTitle)), !(0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') && (0, _react2.jsx)(_Separator.default, {
153
153
  areAnyNewToolbarFlagsEnabled: false
154
154
  }));
155
- return (0, _react2.jsx)(_compiled.Flex, {
155
+ return (0, _react2.jsx)(_flex.Flex, {
156
156
  ref: containerRef
157
157
  }, (0, _react2.jsx)(_DropdownContainer.DropdownContainer, {
158
158
  mountTo: containerRef.current,
@@ -13,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
14
14
  var _Separator = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Separator"));
15
15
  var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
16
- var _compiled = require("@atlaskit/primitives/compiled");
16
+ var _flex = require("@atlaskit/primitives/compiled/flex");
17
17
  var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
18
18
  var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
@@ -138,7 +138,7 @@ function HyperlinkToolbarAppearance(props) {
138
138
  return null;
139
139
  }
140
140
  var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean((_props$editorPluginAp2 = props.editorPluginApi) === null || _props$editorPluginAp2 === void 0 ? void 0 : _props$editorPluginAp2.toolbar));
141
- return /*#__PURE__*/_react.default.createElement(_compiled.Flex, null, /*#__PURE__*/_react.default.createElement(_LinkToolbarAppearance.LinkToolbarAppearance, {
141
+ return /*#__PURE__*/_react.default.createElement(_flex.Flex, null, /*#__PURE__*/_react.default.createElement(_LinkToolbarAppearance.LinkToolbarAppearance, {
142
142
  key: "link-appearance",
143
143
  url: url,
144
144
  intl: intl,
@@ -17,7 +17,7 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
17
17
  var _types = require("@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types");
18
18
  var _DropdownContainer = require("@atlaskit/editor-common/ui-menu/DropdownContainer");
19
19
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
20
- var _compiled = require("@atlaskit/primitives/compiled");
20
+ var _flex = require("@atlaskit/primitives/compiled/flex");
21
21
  var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
22
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
23
23
  var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
@@ -185,7 +185,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
185
185
  }),
186
186
  areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
187
187
  }, title);
188
- return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
188
+ return /*#__PURE__*/_react.default.createElement(_flex.Flex, {
189
189
  ref: containerRef,
190
190
  gap: "space.075"
191
191
  }, /*#__PURE__*/_react.default.createElement(_DropdownContainer.DropdownContainer, {
@@ -17,6 +17,7 @@ var _reactIntl = require("react-intl");
17
17
  var _card = require("@atlaskit/editor-common/messages/card");
18
18
  var _whitespace = require("@atlaskit/editor-common/whitespace/whitespace");
19
19
  var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
20
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
20
21
  var _useSmartLinkDestinationUrl = require("@atlaskit/smart-card/hook/use-smart-link-destination-url");
21
22
  var _utils = require("./utils");
22
23
  var _excluded = ["children", "isSelected", "isVisible", "testId", "url"];
@@ -221,6 +222,9 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
221
222
  observer.observe(parent);
222
223
  return function () {
223
224
  observer.disconnect();
225
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
226
+ updateOverlay.cancel();
227
+ }
224
228
  };
225
229
  }, [isVisible, setVisibility]);
226
230
  var destinationUrl = (_useSmartLinkDestinat = (0, _useSmartLinkDestinationUrl.useSmartLinkDestinationUrl)(url)) !== null && _useSmartLinkDestinat !== void 0 ? _useSmartLinkDestinat : url;
@@ -13,7 +13,9 @@ var _link = require("@atlaskit/editor-common/messages/link");
13
13
  var _panelRight = _interopRequireDefault(require("@atlaskit/icon/core/panel-right"));
14
14
  var _extractSmartLinkEmbed = require("@atlaskit/link-extractors/extract-smart-link-embed");
15
15
  var _useSmartLinkContext2 = require("@atlaskit/link-provider/use-smart-link-context");
16
- var _compiled = require("@atlaskit/primitives/compiled");
16
+ var _box = require("@atlaskit/primitives/compiled/box");
17
+ var _flex = require("@atlaskit/primitives/compiled/flex");
18
+ var _inline = require("@atlaskit/primitives/compiled/inline");
17
19
  var _smartCard = require("@atlaskit/smart-card");
18
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
21
  var _utils = require("../../pm-plugins/utils");
@@ -71,24 +73,24 @@ var OpenPreviewPanelToolbarButton = exports.OpenPreviewPanelToolbarButton = func
71
73
  /*#__PURE__*/
72
74
  // This is a hack required for Jira until areToolbarFlagsEnabled are enabled to ensure the icon has padding
73
75
  // Padding is removed when areToolbarFlagsEnabled for a button with icon only in platform/packages/editor/editor-common/src/ui/FloatingToolbar/Button.tsx
74
- _react.default.createElement(_compiled.Inline, {
76
+ _react.default.createElement(_inline.Inline, {
75
77
  as: "span",
76
78
  space: "space.050",
77
79
  alignBlock: "center"
78
- }, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
80
+ }, /*#__PURE__*/_react.default.createElement(_box.Box, {
79
81
  as: "span",
80
82
  "aria-hidden": true,
81
83
  role: "presentation"
82
84
  }), /*#__PURE__*/_react.default.createElement(_panelRight.default, {
83
85
  label: "",
84
86
  spacing: "spacious"
85
- }), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
87
+ }), /*#__PURE__*/_react.default.createElement(_box.Box, {
86
88
  as: "span",
87
89
  "aria-hidden": true,
88
90
  role: "presentation"
89
91
  }));
90
92
  if (openPreviewPanel && isPanelAvailable) {
91
- return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
93
+ return /*#__PURE__*/_react.default.createElement(_flex.Flex, {
92
94
  gap: "space.050"
93
95
  }, /*#__PURE__*/_react.default.createElement(_Button.default, {
94
96
  testId: "open-preview-panel-floating-toolbar-button",
@@ -30,7 +30,9 @@ var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-l
30
30
  var _smartLinkEmbed = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-embed"));
31
31
  var _smartLinkInline = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-inline"));
32
32
  var _useSmartCardContext = require("@atlaskit/link-provider/use-smart-card-context");
33
- var _compiled = require("@atlaskit/primitives/compiled");
33
+ var _box = require("@atlaskit/primitives/compiled/box");
34
+ var _flex = require("@atlaskit/primitives/compiled/flex");
35
+ var _pressable = require("@atlaskit/primitives/compiled/pressable");
34
36
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
35
37
  var _doc = require("../pm-plugins/doc");
36
38
  var _currentPastedSmartLink = require("./currentPastedSmartLink");
@@ -62,12 +64,12 @@ var AppearanceOptionIconButton = function AppearanceOptionIconButton(_ref) {
62
64
  label = _ref.label,
63
65
  Icon = _ref.Icon,
64
66
  onClick = _ref.onClick;
65
- return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
67
+ return /*#__PURE__*/_react.default.createElement(_box.Box, {
66
68
  xcss: styles.iconWrapper
67
69
  }, /*#__PURE__*/_react.default.createElement(_toolbarTooltip.ToolbarTooltip, {
68
70
  content: label,
69
71
  position: "bottom"
70
- }, /*#__PURE__*/_react.default.createElement(_compiled.Pressable, {
72
+ }, /*#__PURE__*/_react.default.createElement(_pressable.Pressable, {
71
73
  xcss: (0, _css.cx)(styles.iconButton, isDisabled && styles.iconButtonDisabled, !isDisabled && currentAppearance === appearance && styles.iconButtonSelected),
72
74
  "aria-label": label,
73
75
  "aria-pressed": currentAppearance === appearance,
@@ -344,7 +346,7 @@ var PasteDisplayAsMenuHorizontalView = function PasteDisplayAsMenuHorizontalView
344
346
  var isEmbedSupported =
345
347
  // Whatever was pasted already displays this way, so the option must stay selectable.
346
348
  currentAppearance === 'embed' || Boolean(isEmbedSupportedFromAppearanceContext || isEmbedSupportedFromSelection);
347
- return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
349
+ return /*#__PURE__*/_react.default.createElement(_flex.Flex, {
348
350
  xcss: styles.appearanceBox,
349
351
  gap: "space.050"
350
352
  }, /*#__PURE__*/_react.default.createElement(AppearanceOptionIconButton, {
@@ -38,7 +38,7 @@ export class BlockCardComponent extends React.PureComponent {
38
38
 
39
39
  // don't dispatch immediately since we might be in the middle of
40
40
  // rendering a nodeview
41
- rafSchedule(() => {
41
+ const scheduleRegisterCard = rafSchedule(() => {
42
42
  const pos = getPos();
43
43
  if (typeof pos !== 'number') {
44
44
  return;
@@ -49,7 +49,11 @@ export class BlockCardComponent extends React.PureComponent {
49
49
  pos,
50
50
  id: this.props.id
51
51
  })(view.state.tr));
52
- })();
52
+ });
53
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
54
+ this.pendingRegisterCard = scheduleRegisterCard;
55
+ }
56
+ scheduleRegisterCard();
53
57
  });
54
58
  _defineProperty(this, "removeCardDispatched", false);
55
59
  _defineProperty(this, "gapCursorSpan", () => {
@@ -78,6 +82,11 @@ export class BlockCardComponent extends React.PureComponent {
78
82
  findOverflowScrollParent(props.view.dom) || undefined;
79
83
  }
80
84
  componentWillUnmount() {
85
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
86
+ var _this$pendingRegister;
87
+ (_this$pendingRegister = this.pendingRegisterCard) === null || _this$pendingRegister === void 0 ? void 0 : _this$pendingRegister.cancel();
88
+ this.pendingRegisterCard = undefined;
89
+ }
81
90
  this.removeCard();
82
91
  }
83
92
  removeCard() {
@@ -35,6 +35,16 @@ export const InlineCard = /*#__PURE__*/memo(({
35
35
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
36
36
  const refId = useRef(uuid());
37
37
  const removeCardDispatched = useRef(false);
38
+ const pendingRegisterCard = useRef(null);
39
+ useEffect(() => {
40
+ return () => {
41
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
42
+ var _pendingRegisterCard$;
43
+ (_pendingRegisterCard$ = pendingRegisterCard.current) === null || _pendingRegisterCard$ === void 0 ? void 0 : _pendingRegisterCard$.cancel();
44
+ pendingRegisterCard.current = null;
45
+ }
46
+ };
47
+ }, []);
38
48
  const {
39
49
  getState: getSmartlinkState
40
50
  } = (cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store) || {};
@@ -69,7 +79,7 @@ export const InlineCard = /*#__PURE__*/memo(({
69
79
  } = data;
70
80
  // don't dispatch immediately since we might be in the middle of
71
81
  // rendering a nodeview
72
- rafSchedule(() => {
82
+ const scheduleRegisterCard = rafSchedule(() => {
73
83
  // prosemirror-bump-fix
74
84
  const pos = getPos();
75
85
  if (typeof pos !== 'number') {
@@ -84,7 +94,11 @@ export const InlineCard = /*#__PURE__*/memo(({
84
94
  })(tr);
85
95
  onRes === null || onRes === void 0 ? void 0 : onRes(tr, title);
86
96
  view.dispatch(tr);
87
- })();
97
+ });
98
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
99
+ pendingRegisterCard.current = scheduleRegisterCard;
100
+ }
101
+ scheduleRegisterCard();
88
102
  }, [getPos, view, onRes]);
89
103
  const onError = useCallback(data => {
90
104
  const {
@@ -1,10 +1,11 @@
1
- import React, { memo, useCallback, useMemo, useState } from 'react';
1
+ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics/types/enums';
3
3
  import HoverLinkOverlay from '@atlaskit/editor-common/HoverLinkOverlay';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { extractSmartLinkEmbed } from '@atlaskit/link-extractors/extract-smart-link-embed';
7
7
  import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils/is-within-preview-panel-iframe';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
9
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
9
10
  import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-link-destination-url';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -13,6 +14,12 @@ import { pluginKey } from '../pm-plugins/plugin-key';
13
14
  import { AwarenessWrapper } from '../ui/AwarenessWrapper';
14
15
  import { PreviewInvoker } from '../ui/preview/PreviewInvoker';
15
16
  import { InlineCard } from './inlineCardBase';
17
+ // Module scope so the stored callback's closure chain cannot reach the
18
+ // component scope (getPos, node, view) via V8 context sharing.
19
+ const createRemoveOverlay = setIsInsertedRef => () => {
20
+ var _setIsInsertedRef$cur;
21
+ return (_setIsInsertedRef$cur = setIsInsertedRef.current) === null || _setIsInsertedRef$cur === void 0 ? void 0 : _setIsInsertedRef$cur.call(setIsInsertedRef, false);
22
+ };
16
23
  const selector = states => {
17
24
  var _states$editorViewMod, _states$selectionStat;
18
25
  return {
@@ -39,15 +46,24 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
39
46
  var _pluginInjectionApi$c;
40
47
  const [isHovered, setIsHovered] = useState(false);
41
48
  const [isInserted, setIsInserted] = useState(false);
49
+ const setIsInsertedRef = useRef(setIsInserted);
50
+ useEffect(() => {
51
+ return () => {
52
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
53
+ setIsInsertedRef.current = undefined;
54
+ }
55
+ };
56
+ }, []);
42
57
  const [isResolvedViewRendered, setIsResolvedViewRendered] = useState(false);
43
58
  const editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
44
59
  const destinationUrl = useSmartLinkDestinationUrl(node.attrs.url);
45
60
  const onResolve = useCallback((tr, title) => {
46
61
  const metadata = tr.getMeta(pluginKey);
62
+ const removeOverlay = isExperimentEnabled('platform_editor_reduce_memory_leaks') ? createRemoveOverlay(setIsInsertedRef) : () => setIsInserted(false);
47
63
  if (metadata && metadata.type === 'REGISTER') {
48
- registerRemoveOverlay(() => setIsInserted(false), metadata.info)(tr);
64
+ registerRemoveOverlay(removeOverlay, metadata.info)(tr);
49
65
  } else {
50
- registerRemoveOverlay(() => setIsInserted(false))(tr);
66
+ registerRemoveOverlay(removeOverlay)(tr);
51
67
  }
52
68
  if (title) {
53
69
  setIsResolvedViewRendered(true);
@@ -6,6 +6,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common/constants';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
10
  import { blockCardNodeView } from '../nodeviews/blockCard';
10
11
  import { embedCardNodeView } from '../nodeviews/embedCard';
11
12
  import { InlineCardNodeView } from '../nodeviews/inlineCard';
@@ -236,7 +237,13 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
236
237
  */
237
238
  const invoke = rafSchedule(() => {
238
239
  var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4, _currentState$embedCa;
239
- return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 ? void 0 : (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
240
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
241
+ const index = rafCancellationCallbacks.indexOf(invoke.cancel);
242
+ if (index !== -1) {
243
+ rafCancellationCallbacks.splice(index, 1);
244
+ }
245
+ }
246
+ resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined, currentState === null || currentState === void 0 ? void 0 : (_currentState$embedCa = currentState.embedCardTransformers) === null || _currentState$embedCa === void 0 ? void 0 : _currentState$embedCa.embedCardNodeTransformer);
240
247
  });
241
248
  rafCancellationCallbacks.push(invoke.cancel);
242
249
  invoke();