Skip to content

Commit 166ca1b

Browse files
committed
refactor: simplify loading state handling in ListComponent
1 parent f6f831f commit 166ca1b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/components/List/ListComponent.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ export function ListComponent<T extends any>(props: ListComponentPropsType<T>) {
7878
}
7979
}, [sortedData, header, renderItem, limit])
8080

81+
if (isLoading) {
82+
return <Placeholders placeholder={placeholder} />
83+
}
8184
if (error) {
8285
return <p className="errorMsg">{error?.message || error}</p>
8386
}
@@ -90,5 +93,5 @@ export function ListComponent<T extends any>(props: ListComponentPropsType<T>) {
9093
)
9194
}
9295

93-
return <>{isLoading ? <Placeholders placeholder={placeholder} /> : enrichedItems}</>
96+
return <>{enrichedItems}</>
9497
}

0 commit comments

Comments
 (0)