Skip to content

Commit

Permalink
perf(core): Prevent creation of new contexts object on scope (#6156)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AbhiPrasad committed Nov 8, 2022
1 parent 7db0b7f commit d2dd7e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/scope.ts
Expand Up @@ -262,7 +262,7 @@ export class Scope implements ScopeInterface {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this._contexts[key];
} else {
this._contexts = { ...this._contexts, [key]: context };
this._contexts[key] = context;
}

this._notifyScopeListeners();
Expand Down

0 comments on commit d2dd7e6

Please sign in to comment.