|
1 | 1 | 'use client' |
2 | 2 |
|
3 | 3 | import { useMemo, useState } from 'react' |
4 | | -import { Chip, ChipInput, ChipModalTabs } from '@sim/emcn' |
| 4 | +import { Chip, ChipInput, ChipModalTabs, cn } from '@sim/emcn' |
5 | 5 | import { Search } from '@sim/emcn/icons' |
6 | 6 | import { formatDate } from '@sim/utils/formatting' |
7 | 7 | import { useParams, useRouter } from 'next/navigation' |
@@ -234,8 +234,15 @@ export function RecentlyDeleted() { |
234 | 234 | const restoreWorkspaceFileFolder = useRestoreWorkspaceFileFolder() |
235 | 235 | const restoreChat = useRestoreMothershipChat(workspaceId) |
236 | 236 |
|
237 | | - const { hasNextPage, isFetchingNextPage, isFetchNextPageError, fetchNextPage, isLoading, error } = |
238 | | - deletedQuery |
| 237 | + const { |
| 238 | + hasNextPage, |
| 239 | + isFetchingNextPage, |
| 240 | + isFetchNextPageError, |
| 241 | + fetchNextPage, |
| 242 | + isLoading, |
| 243 | + isPlaceholderData, |
| 244 | + error, |
| 245 | + } = deletedQuery |
239 | 246 |
|
240 | 247 | const loadMoreRef = useLoadMoreSentinel({ |
241 | 248 | onLoadMore: fetchNextPage, |
@@ -396,7 +403,9 @@ export function RecentlyDeleted() { |
396 | 403 | <SettingsEmptyState>No deleted items</SettingsEmptyState> |
397 | 404 | ) |
398 | 405 | ) : ( |
399 | | - <div className={RESOURCE_LIST_STACK}> |
| 406 | + <div |
| 407 | + className={cn(RESOURCE_LIST_STACK, isPlaceholderData && 'opacity-50 transition-opacity')} |
| 408 | + > |
400 | 409 | {filtered.map((resource) => { |
401 | 410 | const isRestoring = restoringIds.has(resource.id) |
402 | 411 | const isRestored = restoredItems.has(resource.id) |
@@ -436,7 +445,11 @@ export function RecentlyDeleted() { |
436 | 445 | View |
437 | 446 | </Chip> |
438 | 447 | ) : ( |
439 | | - <Chip variant='primary' onClick={() => void handleRestore(resource)}> |
| 448 | + <Chip |
| 449 | + variant='primary' |
| 450 | + disabled={isPlaceholderData} |
| 451 | + onClick={() => void handleRestore(resource)} |
| 452 | + > |
440 | 453 | Restore |
441 | 454 | </Chip> |
442 | 455 | ) |
|
0 commit comments