Skip to content

Commit 540f7df

Browse files
committed
Merge branch 'patch-3' of https://github.com/titoBouzout/js-framework-benchmark into titoBouzout-patch-3
2 parents 9a6daad + 801a8a8 commit 540f7df

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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.2",
3+
"version": "1.0.3",
44
"type": "module",
55
"main": "dist/main.js",
66
"js-framework-benchmark": {
@@ -22,7 +22,7 @@
2222
"url": "https://github.com/krausest/js-framework-benchmark.git"
2323
},
2424
"dependencies": {
25-
"pota": "^0.12.118"
25+
"pota": "^0.13.121"
2626
},
2727
"devDependencies": {
2828
"@babel/core": "^7.23.9",

frameworks/keyed/pota/src/main.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ function _random(max) {
6666
function buildData(count) {
6767
let data = new Array(count);
6868
for (let i = 0; i < count; i++) {
69-
const [label, setLabel] = signal(
69+
const [label, setLabel, updateLabel] = signal(
7070
`${adjectives[_random(adjectives.length)]} ${
7171
colours[_random(colours.length)]
7272
} ${nouns[_random(nouns.length)]}`,
7373
);
7474
data[i] = {
7575
id: idCounter++,
7676
label,
77-
setLabel,
77+
updateLabel,
7878
};
7979
}
8080
return data;
@@ -94,17 +94,17 @@ const Button = ({ id, text, fn }) => (
9494
);
9595

9696
const App = () => {
97-
const [data, setData] = signal([]),
97+
const [data, setData, updateData] = signal([]),
9898
[selected, setSelected] = signal(null),
9999
run = () => setData(buildData(1000)),
100100
runLots = () => {
101101
setData(buildData(10000));
102102
},
103-
add = () => setData((d) => [...d, ...buildData(1000)]),
103+
add = () => updateData((d) => [...d, ...buildData(1000)]),
104104
update = () =>
105105
batch(() => {
106106
for (let i = 0, d = data(), len = d.length; i < len; i += 10)
107-
d[i].setLabel((l) => l + " !!!");
107+
d[i].updateLabel((l) => l + " !!!");
108108
}),
109109
swapRows = () => {
110110
const d = data().slice();
@@ -117,7 +117,7 @@ const App = () => {
117117
},
118118
clear = () => setData([]),
119119
remove = (id) =>
120-
setData((d) => {
120+
updateData((d) => {
121121
const idx = d.findIndex((datum) => datum.id === id);
122122
d.splice(idx, 1);
123123
return [...d];

0 commit comments

Comments
 (0)