Skip to content

Commit

Permalink
Merge pull request #37 from gaurangrshah/disable-eslint-hooks-warnings
Browse files Browse the repository at this point in the history
#SHA-22: Fix: ESLint React Hook dependency array warnings
  • Loading branch information
BelkacemYerfa authored Apr 8, 2024
2 parents 4c5cadd + 044d0b9 commit c5fd3a2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/registry/default/extension/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const BreadCrumb = ({
setOpen(!open);
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[activeIndex, value, prevValue]
);

Expand Down Expand Up @@ -223,6 +224,7 @@ export const BreadCrumbItem = forwardRef<
return () => {
onPrevValueChange(value);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [index, onValueChange]);

return (
Expand Down Expand Up @@ -285,6 +287,7 @@ export const BreadCrumbEllipsis = forwardRef<
const arr = [...prev, index];
return arr.sort((a, b) => Number(a) - Number(b));
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [index, onValueChange]);
return (
<span
Expand Down
1 change: 1 addition & 0 deletions src/registry/default/extension/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const Carousel = forwardRef<
break;
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[emblaMainApi, orientation, direction]
);

Expand Down
2 changes: 2 additions & 0 deletions src/registry/default/extension/file-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const FileUploader = forwardRef<
setActiveIndex(-1);
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[value, activeIndex, removeFileFromSet]
);

Expand Down Expand Up @@ -189,6 +190,7 @@ export const FileUploader = forwardRef<
}
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[reSelectAll, value]
);

Expand Down
4 changes: 4 additions & 0 deletions src/registry/default/extension/image-carousel-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function FileUploadCarouselProvider<T>({
return [...(prev || []), fileWithPreview];
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[reSelectAll]
);

Expand All @@ -112,6 +113,7 @@ export function FileUploadCarouselProvider<T>({
return newPreview;
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[emblaMainApi, activeIndex]
);

Expand All @@ -129,6 +131,7 @@ export function FileUploadCarouselProvider<T>({
dropzoneState.inputRef.current?.click();
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[emblaMainApi, activeIndex, removeImageFromPreview]
);

Expand Down Expand Up @@ -162,6 +165,7 @@ export function FileUploadCarouselProvider<T>({
}
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[reSelectAll]
);

Expand Down
2 changes: 2 additions & 0 deletions src/registry/default/extension/multi-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const MultiSelector = ({
onValueChange([...value, val]);
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[value]
);

Expand Down Expand Up @@ -120,6 +121,7 @@ const MultiSelector = ({
}
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[value, inputValue, activeIndex, loop]
);

Expand Down
4 changes: 4 additions & 0 deletions src/registry/default/extension/tree-view-api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const Tree = forwardRef<HTMLDivElement, TreeViewProps>(
if (initialSelectedId) {
expandSpecificTargetedElements(elements, initialSelectedId);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [initialSelectedId, elements]);

const direction = dir === "rtl" ? "rtl" : "ltr";
Expand Down Expand Up @@ -355,17 +356,20 @@ const CollapseButton = forwardRef<
};

elements.forEach(expandTree);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const closeAll = useCallback(() => {
setExpendedItems?.([]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
console.log(expandAll);
if (expandAll) {
expendAllTree(elements);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [expandAll]);

return (
Expand Down

0 comments on commit c5fd3a2

Please sign in to comment.