Anyone know what could be the reason for this behaviour?

so im pushing an object inside an array when save button is clicked. first time clicking on save button pushed the object once, but on second time its pushing the same object twice and so on. Also the labels is not updating. can someone help me figure out where the issue is? codepen is specifically for label https://codepen.io/avinash-tallapaneni/pen/VwEGMoK
1 Reply
Avinash
AvinashOP2y ago
i figured the issue with labels. so i reset the uniqueLabel Now regarding the issue with card i somewhat found the issue. in my previous codepen the save button eventlistner is wrapped inside the
const saveCard = (newValue) => {
saveCardBtn.addEventListener("click", (event) => {}
}
const saveCard = (newValue) => {
saveCardBtn.addEventListener("click", (event) => {}
}
this is done cause the object has to be pushed into specific column. and the check is done via this where if item.boardTitle === newValue the object is pushed. note the value of newVAlue is the column title
database.mainboard.forEach((item) => {
if (item.boardTitle === newValue) {
item.boardColumn.push({
imagePreviewUrl,
cardTitle,
cardDescription,
cardSubtask,
cardAttachments,
cardComments,
cardMembers,
cardlabel,
});
}
});

database.mainboard.forEach((item) => {
if (item.boardTitle === newValue) {
item.boardColumn.push({
imagePreviewUrl,
cardTitle,
cardDescription,
cardSubtask,
cardAttachments,
cardComments,
cardMembers,
cardlabel,
});
}
});

so what i did now is i removed this
const saveCard = (newValue) => {
}
const saveCard = (newValue) => {
}
around the save button, now the object is being pushed to all columns but the incrementation is not happening found the issue
Want results from more Discord servers?
Add your server