diff --git a/src/crawlee/storage_clients/_memory/_dataset_client.py b/src/crawlee/storage_clients/_memory/_dataset_client.py index 0028292e63..85206d4186 100644 --- a/src/crawlee/storage_clients/_memory/_dataset_client.py +++ b/src/crawlee/storage_clients/_memory/_dataset_client.py @@ -171,10 +171,6 @@ async def get_data( total = len(self._records) items = self._records.copy() - # Apply skip_empty filter if requested - if skip_empty: - items = [item for item in items if item] - # Apply sorting if desc: items = list(reversed(items)) @@ -182,6 +178,10 @@ async def get_data( # Apply pagination sliced_items = items[offset : (offset + limit) if limit is not None else total] + # Apply skip_empty filter if requested + if skip_empty: + sliced_items = [item for item in sliced_items if item] + await self._update_metadata(update_accessed_at=True) return DatasetItemsListPage(