@atlaskit/react-ufo 4.3.2 → 4.3.3
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 +7 -0
- package/dist/cjs/create-payload/index.js +4 -0
- package/dist/cjs/create-post-interaction-log-payload/index.js +7 -0
- package/dist/cjs/interaction-metrics/index.js +6 -1
- package/dist/es2019/create-payload/index.js +5 -1
- package/dist/es2019/create-post-interaction-log-payload/index.js +8 -1
- package/dist/es2019/interaction-metrics/index.js +6 -1
- package/dist/esm/create-payload/index.js +5 -1
- package/dist/esm/create-post-interaction-log-payload/index.js +8 -1
- package/dist/esm/interaction-metrics/index.js +6 -1
- package/dist/types/common/react-ufo-payload-schema.d.ts +1 -0
- package/dist/types/interaction-metrics/index.d.ts +1 -0
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +1 -0
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +1 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -330,6 +330,10 @@ function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart, re
|
|
|
330
330
|
if (type === 'update') {
|
|
331
331
|
timing.rerenderCount += 1;
|
|
332
332
|
}
|
|
333
|
+
if (_interactionMetrics.segmentUnmountCache.has(label) && (0, _platformFeatureFlags.fg)('platform_ufo_segment_unmount_count')) {
|
|
334
|
+
timing.unmountCount = _interactionMetrics.segmentUnmountCache.get(label) || 0;
|
|
335
|
+
_interactionMetrics.segmentUnmountCache.delete(label);
|
|
336
|
+
}
|
|
333
337
|
timing.renderDuration += Math.round(actualDuration);
|
|
334
338
|
result.set(label, timing);
|
|
335
339
|
}
|
|
@@ -7,11 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
11
12
|
var _config = require("../config");
|
|
12
13
|
var _utils = require("../create-payload/common/utils");
|
|
13
14
|
var _getReactUfoPayloadVersion = require("../create-payload/utils/get-react-ufo-payload-version");
|
|
14
15
|
var _hiddenTiming = require("../hidden-timing");
|
|
16
|
+
var _interactionMetrics = require("../interaction-metrics");
|
|
15
17
|
var _getLateMutations = _interopRequireDefault(require("./get-late-mutations"));
|
|
16
18
|
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; }
|
|
17
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -86,6 +88,7 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
86
88
|
}).join('/');
|
|
87
89
|
var start = Math.round(startTime);
|
|
88
90
|
var end = Math.round(commitTime);
|
|
91
|
+
var cacheKey = (0, _utils.stringifyLabelStackFully)(labelStack);
|
|
89
92
|
var timing = result.get(label) || {
|
|
90
93
|
labelStack: label,
|
|
91
94
|
startTime: start,
|
|
@@ -106,6 +109,10 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
106
109
|
if (type === 'update') {
|
|
107
110
|
timing.rerenderCount += 1;
|
|
108
111
|
}
|
|
112
|
+
if (_interactionMetrics.segmentUnmountCache.has(cacheKey) && (0, _platformFeatureFlags.fg)('platform_ufo_segment_unmount_count')) {
|
|
113
|
+
timing.unmountCount = _interactionMetrics.segmentUnmountCache.get(cacheKey) || 0;
|
|
114
|
+
_interactionMetrics.segmentUnmountCache.delete(cacheKey);
|
|
115
|
+
}
|
|
109
116
|
timing.renderDuration += Math.round(actualDuration);
|
|
110
117
|
result.set(label, timing);
|
|
111
118
|
}
|
|
@@ -39,7 +39,7 @@ exports.postInteractionLog = exports.interactionSpans = exports.getPerformanceOb
|
|
|
39
39
|
exports.remove = remove;
|
|
40
40
|
exports.removeHoldByID = removeHoldByID;
|
|
41
41
|
exports.removeSegment = removeSegment;
|
|
42
|
-
exports.setInteractionPerformanceEvent = void 0;
|
|
42
|
+
exports.setInteractionPerformanceEvent = exports.segmentUnmountCache = void 0;
|
|
43
43
|
exports.sinkInteractionHandler = sinkInteractionHandler;
|
|
44
44
|
exports.sinkPostInteractionLogHandler = sinkPostInteractionLogHandler;
|
|
45
45
|
exports.tryComplete = tryComplete;
|
|
@@ -73,6 +73,7 @@ var PreviousInteractionLog = {
|
|
|
73
73
|
var postInteractionLog = exports.postInteractionLog = new _postInteractionLog.default();
|
|
74
74
|
var interactionQueue = [];
|
|
75
75
|
var segmentCache = new Map();
|
|
76
|
+
var segmentUnmountCache = exports.segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
76
77
|
var CLEANUP_TIMEOUT = 60 * 1000;
|
|
77
78
|
var segmentObservers = [];
|
|
78
79
|
function getActiveInteraction() {
|
|
@@ -1185,6 +1186,10 @@ function removeSegment(labelStack) {
|
|
|
1185
1186
|
var segmentInfo = segmentCache.get(key);
|
|
1186
1187
|
if (segmentInfo) {
|
|
1187
1188
|
segmentCache.delete(JSON.stringify(labelStack));
|
|
1189
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_segment_unmount_count')) {
|
|
1190
|
+
var cacheKey = (0, _utils.stringifyLabelStackFully)(labelStack);
|
|
1191
|
+
segmentUnmountCache.set(cacheKey, (segmentUnmountCache.get(cacheKey) || 0) + 1);
|
|
1192
|
+
}
|
|
1188
1193
|
segmentObservers.forEach(function (observer) {
|
|
1189
1194
|
observer.onRemove(segmentInfo);
|
|
1190
1195
|
});
|
|
@@ -13,7 +13,7 @@ import { getBm3Timings } from '../custom-timings';
|
|
|
13
13
|
import { getGlobalErrorCount } from '../global-error-handler';
|
|
14
14
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
15
15
|
import * as initialPageLoadExtraTiming from '../initial-page-load-extra-timing';
|
|
16
|
-
import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
|
|
16
|
+
import { interactionSpans as atlaskitInteractionSpans, segmentUnmountCache } from '../interaction-metrics';
|
|
17
17
|
import { createMemoryStateReport, createPressureStateReport } from '../machine-utilisation';
|
|
18
18
|
import * as resourceTiming from '../resource-timing';
|
|
19
19
|
import { filterResourceTimings } from '../resource-timing/common/utils/resource-timing-buffer';
|
|
@@ -323,6 +323,10 @@ function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart, re
|
|
|
323
323
|
if (type === 'update') {
|
|
324
324
|
timing.rerenderCount += 1;
|
|
325
325
|
}
|
|
326
|
+
if (segmentUnmountCache.has(label) && fg('platform_ufo_segment_unmount_count')) {
|
|
327
|
+
timing.unmountCount = segmentUnmountCache.get(label) || 0;
|
|
328
|
+
segmentUnmountCache.delete(label);
|
|
329
|
+
}
|
|
326
330
|
timing.renderDuration += Math.round(actualDuration);
|
|
327
331
|
result.set(label, timing);
|
|
328
332
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import coinflip from '../coinflip';
|
|
2
3
|
import { DEFAULT_TTVC_REVISION, getConfig, getMostRecentVCRevision, getPostInteractionRate } from '../config';
|
|
3
|
-
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
4
|
+
import { isSegmentLabel, sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
4
5
|
import { getReactUFOPayloadVersion } from '../create-payload/utils/get-react-ufo-payload-version';
|
|
5
6
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
7
|
+
import { segmentUnmountCache } from '../interaction-metrics';
|
|
6
8
|
import getLateMutations from './get-late-mutations';
|
|
7
9
|
function getParentStack(labelStack) {
|
|
8
10
|
if (!labelStack || labelStack.length <= 1) {
|
|
@@ -72,6 +74,7 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
72
74
|
const label = labelStack.map(ls => ls.name).join('/');
|
|
73
75
|
const start = Math.round(startTime);
|
|
74
76
|
const end = Math.round(commitTime);
|
|
77
|
+
const cacheKey = stringifyLabelStackFully(labelStack);
|
|
75
78
|
const timing = result.get(label) || {
|
|
76
79
|
labelStack: label,
|
|
77
80
|
startTime: start,
|
|
@@ -92,6 +95,10 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
92
95
|
if (type === 'update') {
|
|
93
96
|
timing.rerenderCount += 1;
|
|
94
97
|
}
|
|
98
|
+
if (segmentUnmountCache.has(cacheKey) && fg('platform_ufo_segment_unmount_count')) {
|
|
99
|
+
timing.unmountCount = segmentUnmountCache.get(cacheKey) || 0;
|
|
100
|
+
segmentUnmountCache.delete(cacheKey);
|
|
101
|
+
}
|
|
95
102
|
timing.renderDuration += Math.round(actualDuration);
|
|
96
103
|
result.set(label, timing);
|
|
97
104
|
}
|
|
@@ -3,7 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import coinflip from '../coinflip';
|
|
4
4
|
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
5
5
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
6
|
-
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
6
|
+
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
7
7
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
8
8
|
import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
|
|
9
9
|
import { getInteractionId } from '../interaction-id-context';
|
|
@@ -17,6 +17,7 @@ const PreviousInteractionLog = {
|
|
|
17
17
|
export const postInteractionLog = new PostInteractionLog();
|
|
18
18
|
const interactionQueue = [];
|
|
19
19
|
const segmentCache = new Map();
|
|
20
|
+
export const segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
20
21
|
const CLEANUP_TIMEOUT = 60 * 1000;
|
|
21
22
|
const segmentObservers = [];
|
|
22
23
|
export function getActiveInteraction() {
|
|
@@ -1061,6 +1062,10 @@ export function removeSegment(labelStack) {
|
|
|
1061
1062
|
const segmentInfo = segmentCache.get(key);
|
|
1062
1063
|
if (segmentInfo) {
|
|
1063
1064
|
segmentCache.delete(JSON.stringify(labelStack));
|
|
1065
|
+
if (fg('platform_ufo_segment_unmount_count')) {
|
|
1066
|
+
const cacheKey = stringifyLabelStackFully(labelStack);
|
|
1067
|
+
segmentUnmountCache.set(cacheKey, (segmentUnmountCache.get(cacheKey) || 0) + 1);
|
|
1068
|
+
}
|
|
1064
1069
|
segmentObservers.forEach(observer => {
|
|
1065
1070
|
observer.onRemove(segmentInfo);
|
|
1066
1071
|
});
|
|
@@ -24,7 +24,7 @@ import { getBm3Timings } from '../custom-timings';
|
|
|
24
24
|
import { getGlobalErrorCount } from '../global-error-handler';
|
|
25
25
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
26
26
|
import * as initialPageLoadExtraTiming from '../initial-page-load-extra-timing';
|
|
27
|
-
import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
|
|
27
|
+
import { interactionSpans as atlaskitInteractionSpans, segmentUnmountCache } from '../interaction-metrics';
|
|
28
28
|
import { createMemoryStateReport, createPressureStateReport } from '../machine-utilisation';
|
|
29
29
|
import * as resourceTiming from '../resource-timing';
|
|
30
30
|
import { filterResourceTimings } from '../resource-timing/common/utils/resource-timing-buffer';
|
|
@@ -323,6 +323,10 @@ function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart, re
|
|
|
323
323
|
if (type === 'update') {
|
|
324
324
|
timing.rerenderCount += 1;
|
|
325
325
|
}
|
|
326
|
+
if (segmentUnmountCache.has(label) && fg('platform_ufo_segment_unmount_count')) {
|
|
327
|
+
timing.unmountCount = segmentUnmountCache.get(label) || 0;
|
|
328
|
+
segmentUnmountCache.delete(label);
|
|
329
|
+
}
|
|
326
330
|
timing.renderDuration += Math.round(actualDuration);
|
|
327
331
|
result.set(label, timing);
|
|
328
332
|
}
|
|
@@ -2,11 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
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; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import coinflip from '../coinflip';
|
|
6
7
|
import { DEFAULT_TTVC_REVISION, getConfig, getMostRecentVCRevision, getPostInteractionRate } from '../config';
|
|
7
|
-
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
8
|
+
import { isSegmentLabel, sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
8
9
|
import { getReactUFOPayloadVersion } from '../create-payload/utils/get-react-ufo-payload-version';
|
|
9
10
|
import { getPageVisibilityState } from '../hidden-timing';
|
|
11
|
+
import { segmentUnmountCache } from '../interaction-metrics';
|
|
10
12
|
import getLateMutations from './get-late-mutations';
|
|
11
13
|
function getParentStack(labelStack) {
|
|
12
14
|
if (!labelStack || labelStack.length <= 1) {
|
|
@@ -79,6 +81,7 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
79
81
|
}).join('/');
|
|
80
82
|
var start = Math.round(startTime);
|
|
81
83
|
var end = Math.round(commitTime);
|
|
84
|
+
var cacheKey = stringifyLabelStackFully(labelStack);
|
|
82
85
|
var timing = result.get(label) || {
|
|
83
86
|
labelStack: label,
|
|
84
87
|
startTime: start,
|
|
@@ -99,6 +102,10 @@ function transformReactProfilerTimings(reactProfilerTimings) {
|
|
|
99
102
|
if (type === 'update') {
|
|
100
103
|
timing.rerenderCount += 1;
|
|
101
104
|
}
|
|
105
|
+
if (segmentUnmountCache.has(cacheKey) && fg('platform_ufo_segment_unmount_count')) {
|
|
106
|
+
timing.unmountCount = segmentUnmountCache.get(cacheKey) || 0;
|
|
107
|
+
segmentUnmountCache.delete(cacheKey);
|
|
108
|
+
}
|
|
102
109
|
timing.renderDuration += Math.round(actualDuration);
|
|
103
110
|
result.set(label, timing);
|
|
104
111
|
}
|
|
@@ -13,7 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
13
13
|
import coinflip from '../coinflip';
|
|
14
14
|
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
15
15
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
16
|
-
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
16
|
+
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
17
17
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
18
18
|
import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature-flags-accessed';
|
|
19
19
|
import { getInteractionId } from '../interaction-id-context';
|
|
@@ -27,6 +27,7 @@ var PreviousInteractionLog = {
|
|
|
27
27
|
export var postInteractionLog = new PostInteractionLog();
|
|
28
28
|
var interactionQueue = [];
|
|
29
29
|
var segmentCache = new Map();
|
|
30
|
+
export var segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
30
31
|
var CLEANUP_TIMEOUT = 60 * 1000;
|
|
31
32
|
var segmentObservers = [];
|
|
32
33
|
export function getActiveInteraction() {
|
|
@@ -1139,6 +1140,10 @@ export function removeSegment(labelStack) {
|
|
|
1139
1140
|
var segmentInfo = segmentCache.get(key);
|
|
1140
1141
|
if (segmentInfo) {
|
|
1141
1142
|
segmentCache.delete(JSON.stringify(labelStack));
|
|
1143
|
+
if (fg('platform_ufo_segment_unmount_count')) {
|
|
1144
|
+
var cacheKey = stringifyLabelStackFully(labelStack);
|
|
1145
|
+
segmentUnmountCache.set(cacheKey, (segmentUnmountCache.get(cacheKey) || 0) + 1);
|
|
1146
|
+
}
|
|
1142
1147
|
segmentObservers.forEach(function (observer) {
|
|
1143
1148
|
observer.onRemove(segmentInfo);
|
|
1144
1149
|
});
|
|
@@ -5,6 +5,7 @@ import type { LabelStack } from '../interaction-context';
|
|
|
5
5
|
import PostInteractionLog from './post-interaction-log';
|
|
6
6
|
export type { InteractionMetrics, LifecycleMarkType, Span, Mark, MarkType, InteractionType, AbortReasonType, ReactProfilerTiming, RequestInfo, ApdexType, CustomData, CustomTiming, InteractionError, };
|
|
7
7
|
export declare const postInteractionLog: PostInteractionLog;
|
|
8
|
+
export declare const segmentUnmountCache: Map<string, number>;
|
|
8
9
|
export declare function getActiveInteraction(): InteractionMetrics | undefined;
|
|
9
10
|
export declare const getPerformanceObserver: () => PerformanceObserver;
|
|
10
11
|
export declare const setInteractionPerformanceEvent: (entry: PerformanceEventTiming) => void;
|
|
@@ -5,6 +5,7 @@ import type { LabelStack } from '../interaction-context';
|
|
|
5
5
|
import PostInteractionLog from './post-interaction-log';
|
|
6
6
|
export type { InteractionMetrics, LifecycleMarkType, Span, Mark, MarkType, InteractionType, AbortReasonType, ReactProfilerTiming, RequestInfo, ApdexType, CustomData, CustomTiming, InteractionError, };
|
|
7
7
|
export declare const postInteractionLog: PostInteractionLog;
|
|
8
|
+
export declare const segmentUnmountCache: Map<string, number>;
|
|
8
9
|
export declare function getActiveInteraction(): InteractionMetrics | undefined;
|
|
9
10
|
export declare const getPerformanceObserver: () => PerformanceObserver;
|
|
10
11
|
export declare const setInteractionPerformanceEvent: (entry: PerformanceEventTiming) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -200,6 +200,9 @@
|
|
|
200
200
|
},
|
|
201
201
|
"platform_ufo_display_content_resolution_ttvc_v3": {
|
|
202
202
|
"type": "boolean"
|
|
203
|
+
},
|
|
204
|
+
"platform_ufo_segment_unmount_count": {
|
|
205
|
+
"type": "boolean"
|
|
203
206
|
}
|
|
204
207
|
}
|
|
205
208
|
}
|