Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions js/src/common/components/SharedFileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import AbstractFileList from './AbstractFIleList';

export default class SharedFileList extends AbstractFileList {
public loadFileList(): void {
// Mirror UserFileList's setUser guard: skip if already loaded or a fetch is in flight,
// otherwise rapid tab toggling fires concurrent requests and parseResults concats duplicates.
if (this.fileState.files.length > 0 || this.fileState.isLoading()) return;
this.fileState.loadResults();
}

Expand Down
13 changes: 10 additions & 3 deletions js/src/common/states/FileListState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ export default class FileListState {
} as ApiQueryParamsPlural;
}

const results = await app.store.find<File[]>(route, params);

return this.parseResults(results);
try {
const results = await app.store.find<File[]>(route, params);
return this.parseResults(results);
} catch (error) {
// Ensure loading is reset on failure so consumers (e.g. SharedFileList's loadFileList guard)
// can detect that the previous attempt finished and a retry is allowed.
this.loading = false;
m.redraw();
throw error;
}
}

/**
Expand Down
Loading