Skip to content

Commit 80bcf57

Browse files
committed
update pota
1 parent aff59b3 commit 80bcf57

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

frameworks/keyed/pota/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"url": "https://github.com/krausest/js-framework-benchmark.git"
2121
},
2222
"dependencies": {
23-
"pota": "^0.16.162"
23+
"pota": "^0.16.163"
2424
},
2525
"devDependencies": {
2626
"@babel/core": "7.25.2",

frameworks/keyed/pota/src/main.jsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function _random(max) {
6565
}
6666

6767
function buildData(count) {
68-
let data = new Array(count)
68+
const data = new Array(count)
6969
for (let i = 0; i < count; i++) {
7070
const [label, setLabel, updateLabel] = signal(
7171
`${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`,
@@ -82,13 +82,12 @@ function buildData(count) {
8282
const Button = ({ id, text, fn }) => (
8383
<div class="col-sm-6 smallpad">
8484
<button
85+
textContent={text}
8586
id={id}
8687
class="btn btn-primary btn-block"
8788
type="button"
8889
onClick={fn}
89-
>
90-
{text}
91-
</button>
90+
/>
9291
</div>
9392
)
9493

@@ -105,13 +104,15 @@ const App = () => {
105104
updateData(d => [...d, ...buildData(1000)])
106105
},
107106
update = () => {
108-
for (let i = 0, d = data(), len = d.length; i < len; i += 10)
107+
const d = data()
108+
const len = d.length
109+
for (let i = 0; i < len; i += 10)
109110
d[i].updateLabel(l => l + ' !!!')
110111
},
111112
swapRows = () => {
112-
const d = data().slice()
113+
const d = [...data()]
113114
if (d.length > 998) {
114-
let tmp = d[1]
115+
const tmp = d[1]
115116
d[1] = d[998]
116117
d[998] = tmp
117118
setData(d)
@@ -177,6 +178,7 @@ const App = () => {
177178
onClick={e => {
178179
const element = e.target
179180
const { selectRow, removeRow } = element
181+
180182
if (selectRow !== undefined) {
181183
setSelected(selectRow)
182184
} else if (removeRow !== undefined) {
@@ -190,10 +192,10 @@ const App = () => {
190192
const { id, label } = row
191193

192194
return (
193-
<tr class={{ danger: isSelected(id) }}>
195+
<tr class:danger={isSelected(id)}>
194196
<td
195-
class="col-md-1"
196197
textContent={id}
198+
class="col-md-1"
197199
/>
198200
<td class="col-md-4">
199201
<a

0 commit comments

Comments
 (0)