Skip to content

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

Revert "Implement infinite scrolling for storage dashboard and fetch 200 items per request"

Beng Eu9b1e84c065f0
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
index d3477176aa9..68460fa6627 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
@@ -240,7 +240,11 @@ const FileExplorerColumn = ({
onSelectItemMove,
}}
ItemComponent={FileExplorerRow}
- getItemSize={(index) => (index !== 0 && index === columnItems.length ? 85 : 37)}
+ getItemSize={(index) => {
+ if (index !== 0 && index === columnItems.length) return 85
+ return 37
+ }}
+ // Scaffold props for infinite loading
hasNextPage={column.status !== STORAGE_ROW_STATUS.LOADING && column.hasMoreItems}
isLoadingNextPage={column.isLoadingMoreItems}
onLoadNextPage={() => onColumnLoadMore(index, column)}
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index 82c3d6dae8e..c8c1f13ad6e 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -42,7 +42,7 @@ export const useStorageExplorerStore = () => {
return useContext(StorageExplorerContext)
}
-const LIMIT = 200
+const LIMIT = 5
const OFFSET = 0
const DEFAULT_EXPIRY = 10 * 365 * 24 * 60 * 60 // in seconds, default to 1 year
const PREVIEW_SIZE_LIMIT = 10000000 // 10MB
@@ -942,6 +942,8 @@ class StorageExplorerStore {
.from(this.selectedBucket.name)
.list(prefix, options, parameters)
+ console.log('Initial fetch', prefix, options, items)
+
if (showLoading) {
this.updateRowStatus(folderName, STORAGE_ROW_STATUS.READY, index)
}
@@ -974,24 +976,15 @@ class StorageExplorerStore {
}
const parameters = { signal: this.abortController.signal }
+ console.log('fetchMoreFolderContents', { column, prefix, options })
+
const { data: items, error } = await this.supabaseClient.storage
.from(this.selectedBucket.name)
.list(prefix, options, parameters)
if (!error) {
- // Add items to column
- const formattedItems = this.formatFolderItems(items)
- this.columns = this.columns.map((col, idx) => {
- if (idx === index) {
- return {
- ...col,
- items: col.items.concat(formattedItems),
- isLoadingMoreItems: false,
- hasMoreItems: items.length === LIMIT,
- }
- }
- return col
- })
+ // [Joshen] WE LEFT OFF HERE
+ console.log('Fetched more', items)
}
}
@@ -1030,8 +1023,6 @@ class StorageExplorerStore {
id: null,
name: idx === 0 ? this.selectedBucket.name : pathsWithEmptyPrefix[idx],
items: formattedItems,
- hasMoreItems: formattedItems.length === LIMIT,
- isLoadingMoreItems: false,
}
})