bug(web): Intermediate directory nodes in buildFileTree receive child leaf paths instead of directory paths
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
Línea de trabajo
Comienza en packages/web/src/features/git/utils.ts, en buildFileTree; después inspecciona packages/web/src/app/(app)/browse/components/fileTreePanel.tsx y el endpoint getTree. Reproduce el ejemplo de ruta anidada y verifica que los nodos de directorio intermedios expongan sus propias rutas de directorio, incluida la expansión correcta de carpetas y la salida de la API.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
In packages/web/src/features/git/utils.ts, buildFileTree constructs a nested FileTreeNode hierarchy from a flat list of { type, path } objects.
When creating intermediate directory nodes (lines 68-74), the new node's path property is assigned item.path (the full path of the current leaf file being processed), instead of the path of that directory:
// packages/web/src/features/git/utils.ts:67-75
if (!next) {
next = {
name: part,
path: item.path, // <--- Bug: assigns leaf file's path to intermediate directory node
type: nodeType,
children: [],
};
current.children.push(next);
}
Impact
- Broken Folder State & Expansion in UI: In
packages/web/src/app/(app)/browse/components/fileTreePanel.tsx, folder expand/collapse state is tracked viaopenPaths.has(node.path)and route sync viapathParts.slice(0, i + 1).join('/'). Because directory nodes receive the child file's path instead of their own directory path, clicking folders or deep-linking to nested paths causes folder state tracking and auto-expansion to fail. - Public API Corruption: The
getTreeendpoint (/api/git/tree) returnsFileTreeNodewith corrupted directory paths to API consumers.
Reproduction
const flatList = [
{ type: 'blob', path: 'src/components/buttons/PrimaryButton.tsx' }
];
const tree = buildFileTree(flatList);
const srcDir = tree.children[0];
console.log(srcDir.name); // "src"
console.log(srcDir.path); // Expected "src", but Got "src/components/buttons/PrimaryButton.tsx"
Proposed Fix
Reconstruct the directory node's path using parts.slice(0, i + 1).join('/'):
if (!next) {
next = {
name: part,
path: parts.slice(0, i + 1).join('/'),
type: nodeType,
children: [],
};
current.children.push(next);
}
For intermediate directory levels (i < parts.length - 1), this evaluates to the proper directory path (e.g. "src", "src/components"), and for leaf files (i === parts.length - 1), it matches item.path.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.9k
- Forks
- 374
- Merge medio
- 17 h 15 min
- PR fusionados (30 d)
- 38
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de sourcebot-dev/sourcebot
-
fix(web): multiline highlight ranges are broken / omitted in LightweightCodeHighlighterPosiblemente ocupada @riteshvish02 la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
sourcebot-dev/sourcebot#1698 ·
Los mantenedores suelen responder en 1 día
-
[bug] Search result hydration performs duplicate repository lookups within the same chunkPosiblemente ocupada @dipeshbabu la tomó hace 13 días. Abiertobug triage needed
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
sourcebot-dev/sourcebot#1681 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependenciesPosiblemente ocupada @The-AarushiSingh la tomó hace 19 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
sourcebot-dev/sourcebot#1633 ·
Los mantenedores suelen responder en 1 día
-
Generic Git URL configs keep percent-encoded repo namesPosiblemente ocupada @Tyagiquamar la tomó hace 19 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sourcebot-dev/sourcebot#1384 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't exposePosiblemente ocupada @pranav718 la tomó hace 36 días. Abiertoask_sb bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
sourcebot-dev/sourcebot#1137 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de sourcebot-dev/sourcebot
Issues similares
-
feat(subscription): add Manage Subscription (Stripe portal) to the Subscription tab plan cardAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
[Feature] 通知栏合并重复消息并显示次数Abiertoarea:ui enhancement issue-form:feature platform:cross-platform review: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
1lck/Lithe-IDEA#1092 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
developmentseed/deck.gl-raster#693 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Marker-Inc-Korea/AutoRAG#1801 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
iii-hq/iii#2278 · 1 comentario ·
Los mantenedores suelen responder en 1 día