mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NestedFolderPicker: Correctly handle pagination (#72030)
correctly handle pagination in the folder picker when there is more than 1 page of dashboards
This commit is contained in:
parent
4e42f9b619
commit
8f464ac66e
@ -193,7 +193,16 @@ export function createFlatTree(
|
||||
return mapItem(item, folderUID, level);
|
||||
});
|
||||
|
||||
if ((level === 0 && !collection) || (isOpen && collection && !collection.isFullyLoaded)) {
|
||||
// this is very custom to the folder picker right now
|
||||
// we exclude dashboards, but if you have more than 1 page of dashboards collection.isFullyLoaded is false
|
||||
// so we need to check that we're ignoring dashboards and we've fetched all the folders
|
||||
// TODO generalize this properly (e.g. split state by kind?)
|
||||
const isConsideredLoaded = excludeKinds.includes('dashboard') && collection?.lastFetchedKind === 'dashboard';
|
||||
|
||||
const showPlaceholders =
|
||||
(level === 0 && !collection) || (isOpen && collection && !(collection.isFullyLoaded || isConsideredLoaded));
|
||||
|
||||
if (showPlaceholders) {
|
||||
children = children.concat(getPaginationPlaceholders(PAGE_SIZE, folderUID, level));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user