Skip to content

Commit d2dd7e6

Browse files
authored
perf(core): Prevent creation of new contexts object on scope (#6156)
Remove spread operator usage when setting new context so we mutate the current reference instead of creating a new object. Should reduce bundle size and be slightly more performant.
1 parent 7db0b7f commit d2dd7e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/src/scope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class Scope implements ScopeInterface {
262262
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
263263
delete this._contexts[key];
264264
} else {
265-
this._contexts = { ...this._contexts, [key]: context };
265+
this._contexts[key] = context;
266266
}
267267

268268
this._notifyScopeListeners();

0 commit comments

Comments
 (0)