Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/components/Points/PointsTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ const PointsTabs = ({ collectionName, client }) => {
}, [collectionName, offset, similarIds, filters]);
const isLoading = !points && !errorMessage && requestCount > 0;

// Collection is empty when we have no filters/similar and scroll returned 0 points
const isCollectionEmpty =
points &&
!errorMessage &&
requestCount === 0 &&
points.points?.length === 0 &&
similarIds.length === 0 &&
filters.length === 0;

return (
<Grid container spacing={3} role="list" aria-label="Collection Points">
{errorMessage !== null && <ErrorNotifier {...{ message: errorMessage }} />}
Expand All @@ -171,8 +180,8 @@ const PointsTabs = ({ collectionName, client }) => {
<Typography>⚠ Error: {errorMessage}</Typography>
</Grid>
)}
{/* Always render the same PointsFilter instance to preserve filter input state */}
{!errorMessage && (
{/* Hide filter only when collection is empty (isCollectionEmpty is false when there's an error or user has filters/similar) */}
{!isCollectionEmpty && (
<Grid size={12}>
<PointsFilter
similarIds={similarIds}
Expand All @@ -194,11 +203,16 @@ const PointsTabs = ({ collectionName, client }) => {
))}
</>
)}
{points && !errorMessage && requestCount === 0 && points.points?.length === 0 && (
{points && !errorMessage && requestCount === 0 && points.points?.length === 0 && isCollectionEmpty && (
<Grid textAlign={'center'} size={12} role="alert" aria-label="No Points">
<Typography>📪 No Points are present, {collectionName} is empty</Typography>
</Grid>
)}
{points && !errorMessage && requestCount === 0 && points.points?.length === 0 && !isCollectionEmpty && (
<Grid textAlign={'center'} size={12} role="alert" aria-label="No matching points">
<Typography>Nothing matches the current filters</Typography>
</Grid>
)}
{points && !errorMessage && points.points?.length > 0 && (
<>
{points.points?.map((point) => (
Expand Down