Skip to content
Merged
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
26 changes: 20 additions & 6 deletions packages/web-app-files/src/views/trash/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,30 @@ const loadResourcesTask = useTask(function* (signal) {

const areResourcesLoading = computed(() => loadResourcesTask.isRunning || !loadResourcesTask.last)

const footerTextTotal = computed(() =>
$ngettext(
'%{spaceCount} trash bin in total',
'%{spaceCount} trash bins in total',
const footerTextTotal = computed(() => {
const emptyTrashSpaces = unref(spaces).filter((s) => s.hasTrashedItems === false)

if (!emptyTrashSpaces.length) {
return $ngettext(
'%{spaceCount} trash bin in total',
'%{spaceCount} trash bins in total',
unref(spaces).length,
{
spaceCount: unref(spaces).length.toString()
Comment on lines +168 to +176
Copy link

Copilot AI Jul 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeatedly calling unref(spaces) for filtering and counting could be optimized by storing the unwrapped array in a local variable once, then deriving emptyTrashSpaces and totalSpaces from it.

Suggested change
const emptyTrashSpaces = unref(spaces).filter((s) => s.hasTrashedItems === false)
if (!emptyTrashSpaces.length) {
return $ngettext(
'%{spaceCount} trash bin in total',
'%{spaceCount} trash bins in total',
unref(spaces).length,
{
spaceCount: unref(spaces).length.toString()
const unwrappedSpaces = unref(spaces)
const emptyTrashSpaces = unwrappedSpaces.filter((s) => s.hasTrashedItems === false)
if (!emptyTrashSpaces.length) {
return $ngettext(
'%{spaceCount} trash bin in total',
'%{spaceCount} trash bins in total',
unwrappedSpaces.length,
{
spaceCount: unwrappedSpaces.length.toString()

Copilot uses AI. Check for mistakes.
}
)
}

return $ngettext(
'%{spaceCount} trash bin in total (including %{emptyTrashCount} empty)',
'%{spaceCount} trash bins in total (including %{emptyTrashCount} empty)',
unref(spaces).length,
{
spaceCount: unref(spaces).length.toString()
spaceCount: unref(spaces).length.toString(),
emptyTrashCount: emptyTrashSpaces.length.toString()
}
)
)
})

const footerTextFilter = computed(() =>
$ngettext(
Expand Down
Loading