@pitcher/canvas-ui 2026.1.20-101047-beta → 2026.1.20-111900-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/canvas-ui.js CHANGED
@@ -110485,9 +110485,48 @@ function init({
110485
110485
  let filteredFolders = [];
110486
110486
  if (!hasMetadataFilters && foldersResponse.status === "fulfilled" && foldersResponse.value) {
110487
110487
  const foldersFromSearch = foldersResponse.value.results ?? [];
110488
+ const foldersToCache = foldersFromSearch.filter(
110489
+ (folder) => !state$2.folderCache[folder.id] && folder.parent_folder_id
110490
+ );
110491
+ if (foldersToCache.length > 0) {
110492
+ const parentIdsToFetch = Array.from(
110493
+ new Set(foldersToCache.map((f) => f.parent_folder_id).filter(Boolean))
110494
+ ).filter((parentId) => {
110495
+ const hasUncachedChildren = foldersToCache.some(
110496
+ (f) => f.parent_folder_id === parentId && !state$2.folderCache[f.id]
110497
+ );
110498
+ return hasUncachedChildren;
110499
+ });
110500
+ await Promise.all(
110501
+ parentIdsToFetch.map(async (parentId) => {
110502
+ try {
110503
+ const parentFolder = await state$2.folderItemsFetcher?.(parentId, {
110504
+ justFetch: true,
110505
+ setSelectedFolder: false
110506
+ });
110507
+ if (parentFolder) {
110508
+ parentFolder.folders.forEach((subfolder) => {
110509
+ state$2.folderCache[subfolder.id] = {
110510
+ files_count: subfolder.files_count,
110511
+ folders_count: subfolder.folders_count,
110512
+ available_files_count: subfolder.available_files_count,
110513
+ available_folders_count: subfolder.available_folders_count,
110514
+ timestamp: Date.now()
110515
+ };
110516
+ });
110517
+ }
110518
+ } catch (error) {
110519
+ console.error(`Failed to fetch parent folder ${parentId}:`, error);
110520
+ }
110521
+ })
110522
+ );
110523
+ }
110488
110524
  filteredFolders = foldersFromSearch.map((folder) => {
110489
110525
  const cached = state$2.folderCache[folder.id];
110490
110526
  const parentCached = folder.parent_folder_id ? state$2.folderCache[folder.parent_folder_id] : null;
110527
+ if (cached && cached.available_files_count !== void 0 && cached.available_folders_count !== void 0 && cached.available_files_count === 0 && cached.available_folders_count === 0) {
110528
+ return null;
110529
+ }
110491
110530
  if (parentCached && parentCached.available_folders_count !== void 0 && parentCached.available_folders_count === 0) {
110492
110531
  return null;
110493
110532
  }