Skip to content

Commit f351a70

Browse files
committed
fix(recently-deleted): dim the list and disable Restore while a new view loads
1 parent 824b5d3 commit f351a70

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/settings/components/recently-deleted/recently-deleted.tsx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useMemo, useState } from 'react'
4-
import { Chip, ChipInput, ChipModalTabs } from '@sim/emcn'
4+
import { Chip, ChipInput, ChipModalTabs, cn } from '@sim/emcn'
55
import { Search } from '@sim/emcn/icons'
66
import { formatDate } from '@sim/utils/formatting'
77
import { useParams, useRouter } from 'next/navigation'
@@ -234,8 +234,15 @@ export function RecentlyDeleted() {
234234
const restoreWorkspaceFileFolder = useRestoreWorkspaceFileFolder()
235235
const restoreChat = useRestoreMothershipChat(workspaceId)
236236

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
239246

240247
const loadMoreRef = useLoadMoreSentinel({
241248
onLoadMore: fetchNextPage,
@@ -396,7 +403,9 @@ export function RecentlyDeleted() {
396403
<SettingsEmptyState>No deleted items</SettingsEmptyState>
397404
)
398405
) : (
399-
<div className={RESOURCE_LIST_STACK}>
406+
<div
407+
className={cn(RESOURCE_LIST_STACK, isPlaceholderData && 'opacity-50 transition-opacity')}
408+
>
400409
{filtered.map((resource) => {
401410
const isRestoring = restoringIds.has(resource.id)
402411
const isRestored = restoredItems.has(resource.id)
@@ -436,7 +445,11 @@ export function RecentlyDeleted() {
436445
View
437446
</Chip>
438447
) : (
439-
<Chip variant='primary' onClick={() => void handleRestore(resource)}>
448+
<Chip
449+
variant='primary'
450+
disabled={isPlaceholderData}
451+
onClick={() => void handleRestore(resource)}
452+
>
440453
Restore
441454
</Chip>
442455
)

0 commit comments

Comments
 (0)