We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7221794 commit 2450fe1Copy full SHA for 2450fe1
src/hooks/usePropsErrorBoundary.ts
@@ -4,7 +4,7 @@ import type { ICarouselProps } from 'src/Carousel';
4
export function usePropsErrorBoundary(props: ICarouselProps<unknown>) {
5
React.useEffect(() => {
6
const { defaultIndex, data } = props;
7
- if (typeof defaultIndex === 'number') {
+ if (typeof defaultIndex === 'number' && data?.length > 0) {
8
if (defaultIndex < 0 || defaultIndex >= data.length) {
9
throw Error(
10
'DefaultIndex must be in the range of data length.'
0 commit comments