fix: default company export page to README.md instead of first file

When navigating to the company export page without a specific file in
the URL, select README.md by default instead of whichever file happens
to be first in the export result (previously COMPANY.md).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta
2026-03-20 07:59:32 -05:00
parent d6bb71f324
commit 971513d3ae

View File

@@ -609,10 +609,12 @@ export function CompanyExport() {
const ancestors = expandAncestors(urlFile); const ancestors = expandAncestors(urlFile);
setExpandedDirs(new Set([...topDirs, ...ancestors])); setExpandedDirs(new Set([...topDirs, ...ancestors]));
} else { } else {
// Select first file and update URL // Default to README.md if present, otherwise fall back to first file
const firstFile = Object.keys(result.files)[0]; const defaultFile = "README.md" in result.files
if (firstFile) { ? "README.md"
selectFile(firstFile, true); : Object.keys(result.files)[0];
if (defaultFile) {
selectFile(defaultFile, true);
} }
setExpandedDirs(topDirs); setExpandedDirs(topDirs);
} }