fixed bug with id
parent
0872173080
commit
3ae524ec0a
|
@ -44,6 +44,8 @@ function UseVoteLocalStorage() {
|
|||
const vote = (id, up) => {
|
||||
const newVotes = [...storageVotes];
|
||||
|
||||
console.log("new", newVotes);
|
||||
|
||||
const existingVoteIndex = newVotes.findIndex((vote) => vote.id === id);
|
||||
|
||||
if (existingVoteIndex !== -1) {
|
||||
|
@ -161,7 +163,7 @@ function App() {
|
|||
// remove votes for products which no longer in future products
|
||||
setVotes(
|
||||
votesRef.current.filter((v) =>
|
||||
data.FutureProducts.some((item) => item.id === v.id)
|
||||
data.FutureProducts.some((item) => item.Id === v.id)
|
||||
)
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue