diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.test.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.test.ts index 593f26913e9..f53e336eede 100644 --- a/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.test.ts +++ b/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.test.ts @@ -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']) diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.ts index 0510fd96808..0592b5a1535 100644 --- a/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.ts +++ b/apps/studio/components/interfaces/Storage/StorageExplorer/archivedOverlay.utils.ts @@ -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({