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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user