I'm using this library for one of our React projects, it works fine, but there is a bug with it.
I have a SidebarSizeModal React component, which acts like a modal to add/edit/remove and move the sizes (like S, M, L, XL). I have data.sizes array in my ContextAPI. So, in this component, I have:
The issue happens when I try to remove the size, which I do with id.
const onRemoveMeasurement = async (title, id) => {
if (title === "M") {
// If it's "M", you may want to handle this differently
console.log("You can't remove the 'M' size.");
} else {
// Filter out the size to remove from tempSize
const updatedTempSize = tempSize.filter((item) => item.id !== id);
setTempSize(updatedTempSize);
// Update the data.sizes and perform any other required actions
const updatedDataSizes = data.sizes.filter((item) => item.id !== id);
data.setSizes(updatedDataSizes);
}
};
Here, if I try to remove S, L is getting removed and etc.
I'm using this library for one of our React projects, it works fine, but there is a bug with it.
I have a
SidebarSizeModal
React component, which acts like a modal to add/edit/remove and move the sizes (like S, M, L, XL). I havedata.sizes
array in my ContextAPI. So, in this component, I have:and I'm just initiating this
tempSize
arrayThe issue happens when I try to remove the size, which I do with
id
.Here, if I try to remove S, L is getting removed and etc.
My
List
is like following:I debugged a bit the
onRemoveMeasurement
code, which gives following results:the result is correct, but on the page, it shows
S, M, L
, where it showsXL
is removed instead ofS
andS
gets disabled for some reason.