Skip to content

Commit 9eb39e4

Browse files
authored
fix: correctly cache expensive operation (#22)
1 parent 1b5cc5d commit 9eb39e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/rrweb-snapshot/src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ export function splitCssText(
479479
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
480480
return splitCache.get(cssText)!;
481481
}
482+
const og = cssText;
482483
const childNodes = Array.from(style.childNodes);
483484
const splits: string[] = [];
484485
let iterLimit = 0;
@@ -553,7 +554,7 @@ export function splitCssText(
553554
}
554555
}
555556
splits.push(cssText); // either the full thing if no splits were found, or the last split
556-
splitCache.set(cssText, splits);
557+
splitCache.set(og, splits);
557558
return splits;
558559
}
559560

0 commit comments

Comments
 (0)