@atlaskit/react-ufo 3.9.1 → 3.9.2

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,20 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#149337](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149337)
8
+ [`cf5be62e3c4a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf5be62e3c4a3) -
9
+ clean up fg platform_ufo_vc_ttai_on_paint
10
+ - [#148259](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148259)
11
+ [`5504072998c27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5504072998c27) -
12
+ Fixed a performance regression in SPA transitions when feature gate
13
+ 'platform_ufo_no_vc_on_aborted' is enabled. The issue was caused by not properly stopping the VC
14
+ observer when returning early for aborted/invisible interactions, which led to background observer
15
+ processes interfering with subsequent interactions. The fix ensures proper cleanup of the VC
16
+ observer in all code paths.
17
+
3
18
  ## 3.9.1
4
19
 
5
20
  ### Patch Changes
@@ -43,11 +43,12 @@ function _getVCMetrics() {
43
43
  interactionStatus = (0, _getInteractionStatus.default)(interaction);
44
44
  pageVisibilityUpToTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
45
45
  if (!((interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') && (0, _platformFeatureFlags.fg)('platform_ufo_no_vc_on_aborted'))) {
46
- _context.next = 9;
46
+ _context.next = 10;
47
47
  break;
48
48
  }
49
+ (0, _vc.getVCObserver)().stop();
49
50
  return _context.abrupt("return", {});
50
- case 9:
51
+ case 10:
51
52
  isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
52
53
  ssr = interaction.type === 'page_load' && isSSREnabled ? {
53
54
  ssr: (0, _getSsrDoneTimeValue.default)(config)
@@ -55,7 +56,7 @@ function _getVCMetrics() {
55
56
  _interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
56
57
  tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
57
58
  prefix = 'ufo';
58
- _context.next = 16;
59
+ _context.next = 17;
59
60
  return (0, _vc.getVCObserver)().getVCResult(_objectSpread({
60
61
  start: interaction.start,
61
62
  stop: interaction.end,
@@ -64,14 +65,14 @@ function _getVCMetrics() {
64
65
  vc: interaction.vc,
65
66
  isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
66
67
  }, ssr));
67
- case 16:
68
+ case 17:
68
69
  result = _context.sent;
69
70
  if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
70
71
  (0, _vc.getVCObserver)().stop();
71
72
  }
72
73
  _interactionMetrics.postInteractionLog.setLastInteractionFinishVCResult(result);
73
74
  if (config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && (_config$vc2 = _config$vc2.enabledVCRevisions) !== null && _config$vc2 !== void 0 && _config$vc2.includes('fy25.01')) {
74
- _context.next = 26;
75
+ _context.next = 27;
75
76
  break;
76
77
  }
77
78
  ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
@@ -79,32 +80,32 @@ function _getVCMetrics() {
79
80
  return revision === 'fy25.02';
80
81
  });
81
82
  if (ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean) {
82
- _context.next = 23;
83
+ _context.next = 24;
83
84
  break;
84
85
  }
85
86
  return _context.abrupt("return", result);
86
- case 23:
87
+ case 24:
87
88
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
88
89
  'metric:vc90': ttvcV2Revision['metric:vc90']
89
90
  }));
90
- case 26:
91
+ case 27:
91
92
  VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
92
93
  if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
93
- _context.next = 29;
94
+ _context.next = 30;
94
95
  break;
95
96
  }
96
97
  return _context.abrupt("return", result);
97
- case 29:
98
+ case 30:
98
99
  if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
99
- _context.next = 31;
100
+ _context.next = 32;
100
101
  break;
101
102
  }
102
103
  return _context.abrupt("return", result);
103
- case 31:
104
+ case 32:
104
105
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
105
106
  'metric:vc90': VC['90']
106
107
  }));
107
- case 32:
108
+ case 33:
108
109
  case "end":
109
110
  return _context.stop();
110
111
  }
@@ -11,7 +11,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _scheduler = require("scheduler");
13
13
  var _uuid = require("uuid");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _coinflip = _interopRequireDefault(require("../coinflip"));
16
15
  var _config = require("../config");
17
16
  var _experienceTraceIdContext = require("../experience-trace-id-context");
@@ -234,14 +233,10 @@ function UFOSegment(_ref) {
234
233
  var _this = this;
235
234
  if (interactionId.current !== null) {
236
235
  (0, _interactionMetrics.addProfilerTimings)(interactionId.current, this.labelStack, phase, actualDuration, baseDuration, startTime, commitTime);
237
- if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_ttai_on_paint')) {
238
- (0, _scheduleOnPaint.default)(function () {
239
- var paintedTime = performance.now();
240
- _this.complete(paintedTime);
241
- });
242
- } else {
243
- this.complete(commitTime);
244
- }
236
+ (0, _scheduleOnPaint.default)(function () {
237
+ var paintedTime = performance.now();
238
+ _this.complete(paintedTime);
239
+ });
245
240
  }
246
241
  },
247
242
  _internalHold: _internalHold,
@@ -72,7 +72,7 @@ var VCObserverWrapper = /*#__PURE__*/function () {
72
72
  _context.next = 5;
73
73
  return (_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
74
74
  start: param.start,
75
- stop: (0, _platformFeatureFlags.fg)('platform_ufo_vc_ttai_on_paint') ? param.stop : performance.now()
75
+ stop: param.stop
76
76
  });
77
77
  case 5:
78
78
  newResult = _context.sent;
@@ -17,6 +17,7 @@ async function getVCMetrics(interaction) {
17
17
  const interactionStatus = getInteractionStatus(interaction);
18
18
  const pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
19
19
  if ((interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') && fg('platform_ufo_no_vc_on_aborted')) {
20
+ getVCObserver().stop();
20
21
  return {};
21
22
  }
22
23
  const isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 ? void 0 : (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
@@ -1,7 +1,6 @@
1
1
  import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
2
2
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
3
3
  import { v4 as createUUID } from 'uuid';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import coinflip from '../coinflip';
6
5
  import { getConfig, getInteractionRate } from '../config';
7
6
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
@@ -207,14 +206,10 @@ export default function UFOSegment({
207
206
  onRender(phase, actualDuration, baseDuration, startTime, commitTime) {
208
207
  if (interactionId.current !== null) {
209
208
  addProfilerTimings(interactionId.current, this.labelStack, phase, actualDuration, baseDuration, startTime, commitTime);
210
- if (fg('platform_ufo_vc_ttai_on_paint')) {
211
- scheduleOnPaint(() => {
212
- const paintedTime = performance.now();
213
- this.complete(paintedTime);
214
- });
215
- } else {
216
- this.complete(commitTime);
217
- }
209
+ scheduleOnPaint(() => {
210
+ const paintedTime = performance.now();
211
+ this.complete(paintedTime);
212
+ });
218
213
  }
219
214
  },
220
215
  _internalHold,
@@ -37,7 +37,7 @@ class VCObserverWrapper {
37
37
  const oldResult = await ((_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 ? void 0 : _this$oldVCObserver4.getVCResult(param));
38
38
  const newResult = await ((_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
39
39
  start: param.start,
40
- stop: fg('platform_ufo_vc_ttai_on_paint') ? param.stop : performance.now()
40
+ stop: param.stop
41
41
  }));
42
42
  if (oldResult && !newResult) {
43
43
  return oldResult;
@@ -36,11 +36,12 @@ function _getVCMetrics() {
36
36
  interactionStatus = getInteractionStatus(interaction);
37
37
  pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
38
38
  if (!((interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') && fg('platform_ufo_no_vc_on_aborted'))) {
39
- _context.next = 9;
39
+ _context.next = 10;
40
40
  break;
41
41
  }
42
+ getVCObserver().stop();
42
43
  return _context.abrupt("return", {});
43
- case 9:
44
+ case 10:
44
45
  isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
45
46
  ssr = interaction.type === 'page_load' && isSSREnabled ? {
46
47
  ssr: getSSRDoneTimeValue(config)
@@ -48,7 +49,7 @@ function _getVCMetrics() {
48
49
  postInteractionLog.setVCObserverSSRConfig(ssr);
49
50
  tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 || (_interaction$apdex = _interaction$apdex[0]) === null || _interaction$apdex === void 0 ? void 0 : _interaction$apdex.stopTime;
50
51
  prefix = 'ufo';
51
- _context.next = 16;
52
+ _context.next = 17;
52
53
  return getVCObserver().getVCResult(_objectSpread({
53
54
  start: interaction.start,
54
55
  stop: interaction.end,
@@ -57,14 +58,14 @@ function _getVCMetrics() {
57
58
  vc: interaction.vc,
58
59
  isEventAborted: interactionStatus.originalInteractionStatus !== 'SUCCEEDED'
59
60
  }, ssr));
60
- case 16:
61
+ case 17:
61
62
  result = _context.sent;
62
63
  if ((_config$experimentalI = config.experimentalInteractionMetrics) !== null && _config$experimentalI !== void 0 && _config$experimentalI.enabled) {
63
64
  getVCObserver().stop();
64
65
  }
65
66
  postInteractionLog.setLastInteractionFinishVCResult(result);
66
67
  if (config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && (_config$vc2 = _config$vc2.enabledVCRevisions) !== null && _config$vc2 !== void 0 && _config$vc2.includes('fy25.01')) {
67
- _context.next = 26;
68
+ _context.next = 27;
68
69
  break;
69
70
  }
70
71
  ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
@@ -72,32 +73,32 @@ function _getVCMetrics() {
72
73
  return revision === 'fy25.02';
73
74
  });
74
75
  if (ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean) {
75
- _context.next = 23;
76
+ _context.next = 24;
76
77
  break;
77
78
  }
78
79
  return _context.abrupt("return", result);
79
- case 23:
80
+ case 24:
80
81
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
81
82
  'metric:vc90': ttvcV2Revision['metric:vc90']
82
83
  }));
83
- case 26:
84
+ case 27:
84
85
  VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
85
86
  if (!(!VC || !(result !== null && result !== void 0 && result["".concat(prefix, ":vc:clean")]))) {
86
- _context.next = 29;
87
+ _context.next = 30;
87
88
  break;
88
89
  }
89
90
  return _context.abrupt("return", result);
90
- case 29:
91
+ case 30:
91
92
  if (!(interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible')) {
92
- _context.next = 31;
93
+ _context.next = 32;
93
94
  break;
94
95
  }
95
96
  return _context.abrupt("return", result);
96
- case 31:
97
+ case 32:
97
98
  return _context.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
98
99
  'metric:vc90': VC['90']
99
100
  }));
100
- case 32:
101
+ case 33:
101
102
  case "end":
102
103
  return _context.stop();
103
104
  }
@@ -5,7 +5,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React, { lazy, Profiler, Suspense, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
6
6
  import { unstable_NormalPriority as NormalPriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
7
7
  import { v4 as createUUID } from 'uuid';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import coinflip from '../coinflip';
10
9
  import { getConfig, getInteractionRate } from '../config';
11
10
  import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
@@ -222,14 +221,10 @@ export default function UFOSegment(_ref) {
222
221
  var _this = this;
223
222
  if (interactionId.current !== null) {
224
223
  addProfilerTimings(interactionId.current, this.labelStack, phase, actualDuration, baseDuration, startTime, commitTime);
225
- if (fg('platform_ufo_vc_ttai_on_paint')) {
226
- scheduleOnPaint(function () {
227
- var paintedTime = performance.now();
228
- _this.complete(paintedTime);
229
- });
230
- } else {
231
- this.complete(commitTime);
232
- }
224
+ scheduleOnPaint(function () {
225
+ var paintedTime = performance.now();
226
+ _this.complete(paintedTime);
227
+ });
233
228
  }
234
229
  },
235
230
  _internalHold: _internalHold,
@@ -64,7 +64,7 @@ var VCObserverWrapper = /*#__PURE__*/function () {
64
64
  _context.next = 5;
65
65
  return (_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 ? void 0 : _this$newVCObserver3.getVCResult({
66
66
  start: param.start,
67
- stop: fg('platform_ufo_vc_ttai_on_paint') ? param.stop : performance.now()
67
+ stop: param.stop
68
68
  });
69
69
  case 5:
70
70
  newResult = _context.sent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -142,9 +142,6 @@
142
142
  "platform_ufo_custom_data_structured_clone": {
143
143
  "type": "boolean"
144
144
  },
145
- "platform_ufo_vc_ttai_on_paint": {
146
- "type": "boolean"
147
- },
148
145
  "enable_ufo_devtools_api_for_extra_events": {
149
146
  "type": "boolean"
150
147
  },