|
@@ -108,10 +108,10 @@ export default class ProviderView extends View {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async #listFilesAndFolders ({ requestPath, breadcrumbs, signal }) {
|
|
|
+ async #listFilesAndFolders ({ breadcrumbs, signal }) {
|
|
|
const absDirPath = formatBreadcrumbs(breadcrumbs)
|
|
|
|
|
|
- const { items, nextPagePath } = await this.#list({ requestPath, absDirPath, signal })
|
|
|
+ const { items, nextPagePath } = await this.#list({ requestPath: this.nextPagePath, absDirPath, signal })
|
|
|
|
|
|
this.nextPagePath = nextPagePath
|
|
|
|
|
@@ -164,11 +164,12 @@ export default class ProviderView extends View {
|
|
|
breadcrumbs = [...breadcrumbs, { requestPath, name }]
|
|
|
}
|
|
|
|
|
|
+ this.nextPagePath = requestPath
|
|
|
let files = []
|
|
|
let folders = []
|
|
|
do {
|
|
|
const { files: newFiles, folders: newFolders } = await this.#listFilesAndFolders({
|
|
|
- requestPath, breadcrumbs, signal: controller.signal,
|
|
|
+ breadcrumbs, signal: controller.signal,
|
|
|
})
|
|
|
|
|
|
files = files.concat(newFiles)
|
|
@@ -281,17 +282,13 @@ export default class ProviderView extends View {
|
|
|
}
|
|
|
|
|
|
async handleScroll (event) {
|
|
|
- const requestPath = this.nextPagePath || null
|
|
|
-
|
|
|
- if (this.shouldHandleScroll(event) && requestPath) {
|
|
|
+ if (this.shouldHandleScroll(event) && this.nextPagePath) {
|
|
|
this.isHandlingScroll = true
|
|
|
|
|
|
try {
|
|
|
const { files, folders, breadcrumbs } = this.plugin.getPluginState()
|
|
|
|
|
|
- const { files: newFiles, folders: newFolders } = await this.#listFilesAndFolders({
|
|
|
- requestPath, breadcrumbs,
|
|
|
- })
|
|
|
+ const { files: newFiles, folders: newFolders } = await this.#listFilesAndFolders({ breadcrumbs })
|
|
|
|
|
|
const combinedFiles = files.concat(newFiles)
|
|
|
const combinedFolders = folders.concat(newFolders)
|