diff --git a/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue b/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue index 1f01f2003..c6bf5f77a 100644 --- a/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue +++ b/web/satellite/vuetify-poc/src/components/BrowserTableComponent.vue @@ -27,6 +27,7 @@ class="elevation-1" :item-value="(item: BrowserObjectWrapper) => item.browserObject.Key" no-data-text="No results found" + :page="cursor.page" hover must-sort :loading="isFetching || loading" @@ -199,6 +200,7 @@ const isDeleteFileDialogShown = ref(false); const fileToShare = ref(null); const isShareDialogShown = ref(false); const isFileGuideShown = ref(false); +const routePageCache = new Map(); const sortBy = [{ key: 'name', order: 'asc' }]; const headers = [ @@ -337,6 +339,8 @@ const firstFile = computed(() => { * Handles page change event. */ function onPageChange(page: number): void { + const path = filePath.value ? filePath.value + '/' : ''; + routePageCache.set(path, page); obStore.setCursor({ page, limit: options.value?.itemsPerPage ?? 10 }); const lastObjectOnPage = page * cursor.value.limit; @@ -346,7 +350,6 @@ function onPageChange(page: number): void { return; } - const path = filePath.value ? filePath.value + '/' : ''; const tokenKey = Math.ceil(lastObjectOnPage / MAX_KEY_COUNT) * MAX_KEY_COUNT; const tokenToBeFetched = obStore.state.continuationTokens.get(tokenKey); @@ -436,6 +439,15 @@ async function fetchFiles(): Promise { } selected.value = []; + + if (isPaginationEnabled.value) { + const cachedPage = routePageCache.get(path); + if (cachedPage !== undefined) { + obStore.setCursor({ limit: cursor.value.limit, page: cachedPage }); + } else { + obStore.setCursor({ limit: cursor.value.limit, page: 1 }); + } + } } catch (err) { err.message = `Error fetching files. ${err.message}`; notify.notifyError(err, AnalyticsErrorEventSource.FILE_BROWSER_LIST_CALL);