fix: handle empty map cases properly

This commit is contained in:
Jacob Kim
2025-07-30 14:56:31 -07:00
parent 87d35f1751
commit de5450376b

View File

@@ -63,11 +63,12 @@ export class DocumentHistoryTracker {
if (!astHistory || !documentHistory) {
console.error(`Document ${documentPath} not found in AST tracker`);
this.addDocument(documentPath, documentContent, ast);
return; // Early return - document was added with initial state
}
// Push to top (LIFO).
astHistory!.unshift(ast);
documentHistory!.unshift(documentContent);
// Only execute this if the arrays already existed
astHistory.unshift(ast);
documentHistory.unshift(documentContent);
}
/**