Skip to content

Commit 0646996

Browse files
committed
Merge branch 'titoBouzout-patch-8'
2 parents df46fba + ac0041b commit 0646996

File tree

3 files changed

+43
-41
lines changed

3 files changed

+43
-41
lines changed

frameworks/keyed/pota/package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/pota/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-framework-benchmark-pota",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"type": "module",
55
"main": "dist/main.js",
66
"js-framework-benchmark": {
@@ -20,7 +20,7 @@
2020
"url": "https://github.com/krausest/js-framework-benchmark.git"
2121
},
2222
"dependencies": {
23-
"pota": "^0.17.171"
23+
"pota": "^0.17.177"
2424
},
2525
"devDependencies": {
2626
"@babel/core": "7.26.0",

frameworks/keyed/pota/src/main.jsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,11 @@ function _random(max) {
6767
function buildData(count) {
6868
const data = new Array(count)
6969
for (let i = 0; i < count; i++) {
70-
const [label, setLabel, updateLabel] = signal(
70+
const label = signal(
7171
`${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`,
7272
)
73-
data[i] = {
74-
id: idCounter++,
75-
label,
76-
updateLabel,
77-
}
73+
label.id = idCounter++
74+
data[i] = label
7875
}
7976
return data
8077
}
@@ -86,14 +83,17 @@ const Button = ({ id, text, fn }) => (
8683
id={id}
8784
class="btn btn-primary btn-block"
8885
type="button"
89-
on:click={fn}
86+
on:click={(e)=>{
87+
e.stopPropagation()
88+
fn()
89+
}}
9090
/>
9191
</div>
9292
)
9393

9494
const App = () => {
9595
const [data, setData, updateData] = signal([]),
96-
[selected, setSelected] = signal(null),
96+
[selected, setSelected] = signal(),
9797
run = () => {
9898
setData(buildData(1000))
9999
},
@@ -107,7 +107,7 @@ const App = () => {
107107
const d = data()
108108
const len = d.length
109109
for (let i = 0; i < len; i += 10)
110-
d[i].updateLabel(l => l + ' !!!')
110+
d[i].update(l => l + ' !!!')
111111
},
112112
swapRows = () => {
113113
const d = [...data()]
@@ -176,6 +176,8 @@ const App = () => {
176176
<table
177177
class="table table-hover table-striped test-data"
178178
on:click={e => {
179+
e.stopPropagation()
180+
179181
const element = e.target
180182
const { selectRow, removeRow } = element
181183

@@ -189,7 +191,7 @@ const App = () => {
189191
<tbody>
190192
<For each={data}>
191193
{row => {
192-
const { id, label } = row
194+
const { id, read } = row
193195

194196
return (
195197
<tr class:danger={isSelected(id)}>
@@ -199,7 +201,7 @@ const App = () => {
199201
/>
200202
<td class="col-md-4">
201203
<a
202-
textContent={label}
204+
textContent={read}
203205
prop:selectRow={id}
204206
/>
205207
</td>

0 commit comments

Comments
 (0)