fixed bug with id

main
alex 2024-06-02 13:20:39 +02:00
parent 0872173080
commit 3ae524ec0a
1 changed files with 3 additions and 1 deletions

View File

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