Skip to content

Commit bb25ee1

Browse files
committed
fix: fix tests and update names
1 parent e78e453 commit bb25ee1

File tree

13 files changed

+153
-118
lines changed

13 files changed

+153
-118
lines changed

packages/@lwc/engine-core/src/framework/hydration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ let hasMismatch = false;
9292
export function hydrateRoot(vm: VM) {
9393
hasMismatch = false;
9494

95-
logGlobalOperationStartWithVM(OperationId.GlobalRender, vm);
95+
logGlobalOperationStartWithVM(OperationId.GlobalSsrHydrate, vm);
9696

9797
runConnectedCallback(vm);
9898
hydrateVM(vm);
@@ -107,7 +107,7 @@ export function hydrateRoot(vm: VM) {
107107
logHydrationWarning('Hydration completed with errors.');
108108
}
109109
}
110-
logGlobalOperationEndWithVM(OperationId.GlobalRender, vm);
110+
logGlobalOperationEndWithVM(OperationId.GlobalSsrHydrate, vm);
111111
}
112112

113113
function hydrateVM(vm: VM) {

packages/@lwc/engine-core/src/framework/profiler.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ export const enum OperationId {
2222
ErrorCallback = 6,
2323
GlobalRender = 7,
2424
GlobalRerender = 8,
25+
GlobalSsrHydrate = 9,
2526
}
2627

27-
type GlobalOperationId = OperationId.GlobalRender | OperationId.GlobalRerender;
28+
type GlobalOperationId =
29+
| OperationId.GlobalRender
30+
| OperationId.GlobalRerender
31+
| OperationId.GlobalSsrHydrate;
2832

2933
const enum Phase {
3034
Start = 0,
@@ -60,8 +64,9 @@ const operationIdNameMapping = [
6064
'renderedCallback',
6165
'disconnectedCallback',
6266
'errorCallback',
63-
'lwc-hydrate',
67+
'lwc-render',
6468
'lwc-rerender',
69+
'lwc-ssr-hydrate',
6570
] as const satisfies Record<OperationId, string>;
6671

6772
const operationTooltipMapping = [
@@ -79,10 +84,12 @@ const operationTooltipMapping = [
7984
'component disconnectedCallback()',
8085
// errorCallback
8186
'component errorCallback()',
82-
// lwc-hydrate
87+
// lwc-render
8388
'component first rendered',
8489
// lwc-rerender
8590
'component re-rendered',
91+
// lwc-ssr-hydrate
92+
'component hydrated from server-rendered HTML',
8693
] as const satisfies Record<OperationId, string>;
8794

8895
// Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
@@ -154,11 +161,12 @@ function getProperties(vm: VM<any, any>): [string, string][] {
154161
function getColor(opId: OperationId): TrackColor {
155162
// As of Sept 2024: primary (dark blue), secondary (light blue), tertiary (green)
156163
switch (opId) {
157-
// GlobalHydrate and Constructor tend to occur at the top level
164+
// GlobalSsrHydrate, GlobalRender, and Constructor tend to occur at the top level
158165
case OperationId.GlobalRender:
166+
case OperationId.GlobalSsrHydrate:
159167
case OperationId.Constructor:
160168
return 'primary';
161-
// GlobalRehydrate also occurs at the top level, but we want to use tertiary (green) because it's easier to
169+
// GlobalRerender also occurs at the top level, but we want to use tertiary (green) because it's easier to
162170
// distinguish from primary, and at a glance you should be able to easily tell re-renders from first renders.
163171
case OperationId.GlobalRerender:
164172
return 'tertiary';
@@ -267,7 +275,6 @@ export const profilerControl = {
267275
};
268276

269277
export function logOperationStart(opId: OperationId, vm: VM) {
270-
if (opId === OperationId.ConnectedCallback) debugger;
271278
if (isMeasureEnabled) {
272279
const markName = getMarkName(opId, vm);
273280
start(markName);

packages/@lwc/engine-core/src/framework/vm.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ export function runConnectedCallback(vm: VM) {
701701
}
702702
const { connectedCallback } = vm.def;
703703
if (!isUndefined(connectedCallback)) {
704-
console.log('connectedCallback start', performance.now());
705704
logOperationStart(OperationId.ConnectedCallback, vm);
706705

707706
if (!process.env.IS_BROWSER) {
@@ -715,7 +714,6 @@ export function runConnectedCallback(vm: VM) {
715714
vm.renderer.stopTrackingMutations(vm.elm);
716715
}
717716

718-
console.log('connectedCallback end', performance.now());
719717
logOperationEnd(OperationId.ConnectedCallback, vm);
720718
}
721719
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or

packages/@lwc/integration-karma/test-hydration/profiler/index.spec.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/@lwc/integration-karma/test-hydration/profiler/x/child/child.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@lwc/integration-karma/test-hydration/profiler/x/child/child.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@lwc/integration-karma/test-hydration/profiler/x/main/main.html

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/@lwc/integration-karma/test-hydration/profiler/x/main/main.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/@lwc/integration-karma/test/misc/performance-timing/index.spec.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function testConstructor(expected) {
2020
});
2121
}
2222

23-
function testRehydration(expected) {
24-
it('component rehydration', () => {
23+
function testRerender(expected) {
24+
it('component rerender', () => {
2525
const elm = createElement('x-child', { is: Child });
2626
document.body.appendChild(elm);
2727

@@ -43,8 +43,8 @@ function testNestedTree(expected) {
4343
});
4444
}
4545

46-
function testNestedRehydration(expected) {
47-
it('captures component nested component tree rehydration', () => {
46+
function testNestedRerender(expected) {
47+
it('captures component nested component tree rerender', () => {
4848
const elm = createElement('x-parent', { is: Parent });
4949
document.body.appendChild(elm);
5050

@@ -92,40 +92,40 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
9292
describe.runIf(process.env.NODE_ENV === 'production')('production mode', () => {
9393
testConstructor([
9494
{
95-
label: /lwc-hydrate/,
95+
label: /lwc-render/,
9696
},
9797
]);
9898

99-
testRehydration([
99+
testRerender([
100100
{
101101
label: /lwc-rerender/,
102102
},
103103
]);
104104

105105
testNestedTree([
106106
{
107-
label: /lwc-hydrate/,
107+
label: /lwc-render/,
108108
},
109109
]);
110110

111-
testNestedRehydration([
111+
testNestedRerender([
112112
{
113113
label: /lwc-rerender/,
114114
},
115115
]);
116116

117117
testLifecycleHooks([
118118
{
119-
label: /lwc-hydrate/,
119+
label: /lwc-render/,
120120
},
121121
]);
122122

123123
testNestedComponentCreation([
124124
{
125-
label: /lwc-hydrate/,
125+
label: /lwc-render/,
126126
children: [
127127
{
128-
label: /lwc-hydrate/,
128+
label: /lwc-render/,
129129
},
130130
],
131131
},
@@ -138,7 +138,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
138138
label: /<x-child> - constructor/,
139139
},
140140
{
141-
label: /lwc-hydrate/,
141+
label: /lwc-render/,
142142
children: [
143143
{
144144
label: /<x-child> - render/,
@@ -150,7 +150,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
150150
},
151151
]);
152152

153-
testRehydration([
153+
testRerender([
154154
{
155155
label: /lwc-rerender/,
156156
children: [
@@ -170,23 +170,23 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
170170
? [
171171
{ label: '<x-parent> - constructor', children: [] },
172172
{
173-
label: 'lwc-hydrate',
173+
label: 'lwc-render',
174174
children: [
175175
{ label: '<x-parent> - render', children: [] },
176176
{
177177
label: '<x-parent> - patch',
178178
children: [
179179
{ label: '<x-child> - constructor', children: [] },
180180
{
181-
label: 'lwc-hydrate',
181+
label: 'lwc-render',
182182
children: [
183183
{ label: '<x-child> - render', children: [] },
184184
{ label: '<x-child> - patch', children: [] },
185185
],
186186
},
187187
{ label: '<x-child> - constructor', children: [] },
188188
{
189-
label: 'lwc-hydrate',
189+
label: 'lwc-render',
190190
children: [
191191
{ label: '<x-child> - render', children: [] },
192192
{ label: '<x-child> - patch', children: [] },
@@ -202,7 +202,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
202202
label: /<x-parent> - constructor/,
203203
},
204204
{
205-
label: /lwc-hydrate/,
205+
label: /lwc-render/,
206206
children: [
207207
{
208208
label: /<x-parent> - render/,
@@ -235,7 +235,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
235235
]
236236
);
237237

238-
testNestedRehydration([
238+
testNestedRerender([
239239
{
240240
label: /lwc-rerender/,
241241
children: [
@@ -268,7 +268,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
268268
label: /<x-lifecycle> - constructor/,
269269
},
270270
{
271-
label: /lwc-hydrate/,
271+
label: /lwc-render/,
272272
children: [
273273
{
274274
label: /<x-lifecycle> - connectedCallback/,
@@ -294,7 +294,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
294294
label: /<x-nested> - constructor/,
295295
},
296296
{
297-
label: /lwc-hydrate/,
297+
label: /lwc-render/,
298298
children: [
299299
{
300300
label: /<x-nested> - render/,
@@ -306,7 +306,7 @@ describe.runIf(isUserTimingSupported && process.env.NODE_ENV !== 'production')(
306306
label: /<x-child> - constructor/,
307307
},
308308
{
309-
label: /lwc-hydrate/,
309+
label: /lwc-render/,
310310
children: [
311311
{
312312
label: /<x-child> - render/,

0 commit comments

Comments
 (0)