fix(web): stop unnecessarily cloning reused ContextState

This commit is contained in:
Joshua Horton 2025-08-04 14:18:50 -05:00
parent bbf673cce2
commit 1dbe62e42e

View file

@ -137,7 +137,7 @@ export class ContextTracker extends CircularArray<ContextState> {
// If we have a perfect match with a pre-existing context, no mutations have
// happened; just re-use the old context state.
if(tailEditLength == 0 && leadTokenShift == 0 && tailTokenShift == 0) {
baseTransition.replaceFinal(new ContextState(matchState), transformDistribution);
baseTransition.replaceFinal(matchState, transformDistribution);
return baseTransition;
} else {
// If we didn't get any input, we really should perfectly match