Skip to content

Commit 34d4b76

Browse files
authored
fix: deduplicate local variables for SSRv2 (#5554)
1 parent 3c3fad1 commit 34d4b76

File tree

18 files changed

+287
-1
lines changed

18 files changed

+287
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"entry": "x/for-each-nested-complex",
3+
"props": {
4+
"lists": [
5+
{
6+
"recordIds": ["a", "b", "c"],
7+
"fields": ["name", "address", "zip"]
8+
},
9+
{
10+
"recordIds": ["d", "e", "f"],
11+
"fields": ["name", "address", "zip"]
12+
}
13+
]
14+
}
15+
}

packages/@lwc/engine-server/src/__tests__/fixtures/for-each-block/child-nested-complex/error.txt

Whitespace-only changes.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<fixture-test>
2+
<strong>
3+
a
4+
</strong>
5+
<x-child>
6+
<!---->
7+
<div>
8+
name
9+
</div>
10+
<!---->
11+
</x-child>
12+
<x-child>
13+
<!---->
14+
<div>
15+
address
16+
</div>
17+
<!---->
18+
</x-child>
19+
<x-child>
20+
<!---->
21+
<div>
22+
zip
23+
</div>
24+
<!---->
25+
</x-child>
26+
<strong>
27+
b
28+
</strong>
29+
<x-child>
30+
<!---->
31+
<div>
32+
name
33+
</div>
34+
<!---->
35+
</x-child>
36+
<x-child>
37+
<!---->
38+
<div>
39+
address
40+
</div>
41+
<!---->
42+
</x-child>
43+
<x-child>
44+
<!---->
45+
<div>
46+
zip
47+
</div>
48+
<!---->
49+
</x-child>
50+
<strong>
51+
c
52+
</strong>
53+
<x-child>
54+
<!---->
55+
<div>
56+
name
57+
</div>
58+
<!---->
59+
</x-child>
60+
<x-child>
61+
<!---->
62+
<div>
63+
address
64+
</div>
65+
<!---->
66+
</x-child>
67+
<x-child>
68+
<!---->
69+
<div>
70+
zip
71+
</div>
72+
<!---->
73+
</x-child>
74+
<strong>
75+
d
76+
</strong>
77+
<x-child>
78+
<!---->
79+
<div>
80+
name
81+
</div>
82+
<!---->
83+
</x-child>
84+
<x-child>
85+
<!---->
86+
<div>
87+
address
88+
</div>
89+
<!---->
90+
</x-child>
91+
<x-child>
92+
<!---->
93+
<div>
94+
zip
95+
</div>
96+
<!---->
97+
</x-child>
98+
<strong>
99+
e
100+
</strong>
101+
<x-child>
102+
<!---->
103+
<div>
104+
name
105+
</div>
106+
<!---->
107+
</x-child>
108+
<x-child>
109+
<!---->
110+
<div>
111+
address
112+
</div>
113+
<!---->
114+
</x-child>
115+
<x-child>
116+
<!---->
117+
<div>
118+
zip
119+
</div>
120+
<!---->
121+
</x-child>
122+
<strong>
123+
f
124+
</strong>
125+
<x-child>
126+
<!---->
127+
<div>
128+
name
129+
</div>
130+
<!---->
131+
</x-child>
132+
<x-child>
133+
<!---->
134+
<div>
135+
address
136+
</div>
137+
<!---->
138+
</x-child>
139+
<x-child>
140+
<!---->
141+
<div>
142+
zip
143+
</div>
144+
<!---->
145+
</x-child>
146+
</fixture-test>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template lwc:render-mode="light">
2+
<slot></slot>
3+
</template>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class Child extends LightningElement {
4+
static renderMode = 'light';
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template lwc:render-mode="light">
2+
<template for:each={lists} for:item="list" if:true={list}>
3+
<template for:each={list.recordIds} for:item="recordId">
4+
<strong key={recordId}>{recordId}</strong>
5+
<template for:each={list.fields} for:item="field" for:index="index">
6+
<x-child key={field}>
7+
<div>{field}</div>
8+
</x-child>
9+
</template>
10+
</template>
11+
</template>
12+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { LightningElement, api } from 'lwc';
2+
3+
export default class Test extends LightningElement {
4+
static renderMode = 'light';
5+
6+
@api lists;
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"entry": "x/for-each-nested-no-index",
3+
"props": {
4+
"list": [
5+
{
6+
"continent": "europe",
7+
"cities": ["paris", "london", "rome"]
8+
},
9+
{
10+
"continent": "asia",
11+
"cities": ["tokyo", "kuala lumpur", "singapore"]
12+
}
13+
]
14+
}
15+
}

packages/@lwc/engine-server/src/__tests__/fixtures/for-each-block/nested-no-index/error.txt

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<fixture-test>
2+
<template shadowrootmode="open">
3+
<ol>
4+
<li>
5+
europe
6+
<strong>
7+
paris
8+
</strong>
9+
<strong>
10+
london
11+
</strong>
12+
<strong>
13+
rome
14+
</strong>
15+
</li>
16+
<li>
17+
asia
18+
<strong>
19+
tokyo
20+
</strong>
21+
<strong>
22+
kuala lumpur
23+
</strong>
24+
<strong>
25+
singapore
26+
</strong>
27+
</li>
28+
</ol>
29+
</template>
30+
</fixture-test>

0 commit comments

Comments
 (0)