Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Prepend new folders to the top of the column

Joshen Limf908098389b2
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index 82c3d6dae8e..9acb2433b8e 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -272,10 +272,11 @@ class StorageExplorerStore {
}
addNewFolderPlaceholder = (columnIndex) => {
+ const isPrepend = true
const folderName = 'Untitled folder'
const folderType = STORAGE_ROW_TYPES.FOLDER
const columnIdx = columnIndex === -1 ? this.getLatestColumnIndex() : columnIndex
- this.addTempRow(folderType, folderName, STORAGE_ROW_STATUS.EDITING, columnIdx)
+ this.addTempRow(folderType, folderName, STORAGE_ROW_STATUS.EDITING, columnIdx, {}, isPrepend)
}
addNewFolder = async (folderName, columnIndex) => {
@@ -1230,11 +1231,13 @@ class StorageExplorerStore {
return formattedItems
}
- addTempRow = (type, name, status, columnIndex, metadata = {}) => {
+ addTempRow = (type, name, status, columnIndex, metadata = {}, isPrepend = false) => {
const updatedColumns = this.columns.map((column, idx) => {
if (idx === columnIndex) {
const tempRow = { type, name, status, metadata }
- const updatedItems = column.items.concat([tempRow])
+ const updatedItems = isPrepend
+ ? [tempRow].concat(column.items)
+ : column.items.concat([tempRow])
return { ...column, items: updatedItems }
}
return column