fix(storage): hide the empty folder placeholder from archived rows

The live listing filters it out of every folder, but the archived overlay
was rendering it as a file. It still rolls its folder up, so an archived
empty folder stays visible rather than exposing the placeholder.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3euXsz25sTybsGTcxCFfn
This commit is contained in:
Claude committed 2026-10-05 16:04:37 +00:00
1 parent a11cd724d3
commit 252fccb9f1
2 files changed
+23

No files matched your search

@@ -110,6 +110,24 @@ describe('getArchivedOverlayItems', () => {
expect(rows.map((r) => r.type)).toEqual([STORAGE_ROW_TYPES.FOLDER, STORAGE_ROW_TYPES.FILE])
})
it('hides the empty folder placeholder, as the live listing does', () => {
expect(overlay(['matches'], [archived('matches/.emptyFolderPlaceholder')])).toEqual([])
})
it('still shows the folder whose only archived object is the placeholder', () => {
const rows = overlay([], [archived('matches/.emptyFolderPlaceholder')])
expect(rows.map((r) => r.name)).toEqual(['matches'])
expect(rows[0].type).toBe(STORAGE_ROW_TYPES.FOLDER)
})
it('still shows a folder that holds a real object beside the placeholder', () => {
const rows = overlay(
[],
[archived('matches/.emptyFolderPlaceholder'), archived('matches/final.png')]
)
expect(rows.map((r) => r.name)).toEqual(['matches'])
})
it('only descends one level at a time', () => {
const rows = overlay([], [archived('a/b/c/d.png')])
expect(rows.map((r) => r.name)).toEqual(['a'])
@@ -1,5 +1,6 @@
import { STORAGE_ROW_STATUS, STORAGE_ROW_TYPES } from '../Storage.constants'
import type { StorageItem } from '../Storage.types'
import { EMPTY_FOLDER_PLACEHOLDER_FILE_NAME } from './StorageExplorer.utils'
import type { ArchivedObject } from '@/data/storage/versioning/archived-objects-query'
const splitPath = (path: string): string[] => path.split('/').filter((segment) => segment !== '')
@@ -40,6 +41,10 @@ export const getArchivedOverlayItems = ({
continue
}
// Hidden as in the live listing. It still rolled the folder up above, so an archived
// empty folder stays visible and actionable rather than showing its placeholder.
if (nextSegment === EMPTY_FOLDER_PLACEHOLDER_FILE_NAME) continue
if (existingItemNames.has(nextSegment)) continue
files.push({