Skip to content

Commit c5edd4a

Browse files
author
david moreno
committed
update
1 parent 9f8f941 commit c5edd4a

3 files changed

Lines changed: 27 additions & 31 deletions

File tree

components/file-tree.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ interface DirectoryEntry {
5151
}
5252

5353
// Constantes para optimización
54-
const MAX_INITIAL_DEPTH = 2
55-
const MAX_VISIBLE_ITEMS = 1000
54+
const MAX_VISIBLE_ITEMS = 10000 // Aumentamos el límite de elementos visibles
5655
const CHUNK_SIZE = 100
5756
const FILE_CACHE_SIZE = 50 // Máximo de archivos en cache
5857
const CACHE_EXPIRY = 300000 // 5 minutos
@@ -1293,14 +1292,12 @@ export function FileTree({ activeFile, onFileSelect, files, onCreateFile, onLoad
12931292
path: absolutePath, // Store absolute path
12941293
children: [],
12951294
isExpanded: false,
1296-
isLoaded: currentDepth < MAX_INITIAL_DEPTH,
1295+
isLoaded: true, // Siempre marcar como cargado
12971296
directoryHandle: handle
12981297
}
12991298

1300-
// Only load children up to initial depth for performance
1301-
if (currentDepth < MAX_INITIAL_DEPTH) {
1302-
entry.children = await readDirectoryRecursively(handle, relativeFullPath, currentDepth + 1, currentBasePath)
1303-
}
1299+
// Cargar todos los hijos recursivamente sin limitación de profundidad
1300+
entry.children = await readDirectoryRecursively(handle, relativeFullPath, currentDepth + 1, currentBasePath)
13041301

13051302
entries.push(entry)
13061303
} else if (handle.kind === 'file') {

main.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,12 @@ const IGNORED_FILES = new Set([
496496

497497
async function readDirectoryStructure(dirPath, options = {}) {
498498
const {
499-
maxDepth = 3,
499+
maxDepth = Infinity, // Eliminamos la limitación de profundidad
500500
currentDepth = 0,
501501
rootPath = null,
502-
lazyLoad = true,
502+
lazyLoad = false, // Deshabilitamos lazy loading para cargar todo
503503
includeFileStats = false,
504-
maxFiles = 1000
504+
maxFiles = 10000 // Aumentamos el límite de archivos
505505
} = options;
506506

507507
if (currentDepth >= maxDepth) return [];
@@ -539,22 +539,18 @@ async function readDirectoryStructure(dirPath, options = {}) {
539539
let children = [];
540540
let hasChildren = false;
541541

542-
if (lazyLoad && currentDepth >= 1) {
543-
// Para lazy loading, solo verificar si tiene hijos sin cargarlos
544-
try {
545-
const subEntries = await fs.promises.readdir(fullPath, { withFileTypes: true });
546-
hasChildren = subEntries.some(subEntry => !shouldIgnoreEntry(subEntry.name, subEntry.isDirectory()));
547-
} catch (error) {
548-
hasChildren = false;
549-
}
550-
} else {
551-
// Cargar hijos recursivamente solo para los primeros niveles
542+
// Siempre cargar hijos recursivamente para todos los niveles
543+
try {
552544
children = await readDirectoryStructure(fullPath, {
553545
...options,
554546
currentDepth: currentDepth + 1,
555547
rootPath: actualRootPath
556548
});
557549
hasChildren = children.length > 0;
550+
} catch (error) {
551+
console.warn('[WARN] Could not read subdirectory:', fullPath, error);
552+
children = [];
553+
hasChildren = false;
558554
}
559555

560556
structure.push({
@@ -564,8 +560,8 @@ async function readDirectoryStructure(dirPath, options = {}) {
564560
fullPath: fullPath,
565561
children: children,
566562
hasChildren: hasChildren,
567-
isExpanded: currentDepth < 1, // Solo auto-expandir el primer nivel
568-
isLoaded: !lazyLoad || currentDepth < 1
563+
isExpanded: true, // Auto-expandir todos los niveles
564+
isLoaded: true // Marcar todos como cargados
569565
});
570566
}
571567

next.config.mjs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ const nextConfig = {
3333
webpack: (config, { isServer }) => {
3434
// Configuración para manejar archivos CSS
3535
if (!isServer) {
36-
config.optimization.splitChunks.cacheGroups = {
37-
...config.optimization.splitChunks.cacheGroups,
38-
styles: {
39-
name: 'styles',
40-
test: /\.(css|scss)$/,
41-
chunks: 'all',
42-
enforce: true,
43-
},
44-
};
36+
// Verificar si splitChunks existe y es un objeto antes de modificarlo
37+
if (config.optimization.splitChunks && typeof config.optimization.splitChunks === 'object') {
38+
config.optimization.splitChunks.cacheGroups = {
39+
...config.optimization.splitChunks.cacheGroups,
40+
styles: {
41+
name: 'styles',
42+
test: /\.(css|scss)$/,
43+
chunks: 'all',
44+
enforce: true,
45+
},
46+
};
47+
}
4548
}
4649
return config;
4750
},

0 commit comments

Comments
 (0)