fix: list component fixed (#162)

* fix: list component fixed

* style: ran prettier

* Update List.tsx

* refactor: remove console log

---------

Co-authored-by: Razboy20 <razboy20@gmail.com>
This commit is contained in:
Som Gupta
2024-03-14 00:17:47 -05:00
committed by GitHub
parent e919e96c53
commit 5714ed16d7
2 changed files with 6 additions and 7 deletions

View File

@@ -75,13 +75,12 @@ function List<T>(props: ListProps<T>): JSX.Element {
useEffect(() => {
// check if the draggables content has *actually* changed
if (props.draggables.every((element, index) => equalityCheck(element, items[index].content))) {
console.log("List's draggables have not changed");
if (
props.draggables.length === items.length &&
props.draggables.every((element, index) => equalityCheck(element, items[index].content))
) {
return;
}
console.log("List's draggables have changed, updating...");
setItems(wrap(props.draggables));
}, [props.draggables]);