refactor(createCachedDiffCalculator): use both newStr and oldStr as cache keys

This commit is contained in:
Haileyesus
2026-02-12 20:55:22 +03:00
parent f6ed3cbd6d
commit b8f06c8aa4

View File

@@ -87,7 +87,7 @@ export const createCachedDiffCalculator = (): DiffCalculator => {
const cache = new Map<string, DiffLine[]>();
return (oldStr: string, newStr: string) => {
const key = `${oldStr.length}-${newStr.length}-${oldStr.slice(0, 50)}`;
const key = JSON.stringify([oldStr, newStr]);
const cached = cache.get(key);
if (cached) {
return cached;