From c807ac59b533f2ba3887b0702a0d0a33671787dd Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Wed, 15 Mar 2017 21:54:33 -0700 Subject: [PATCH] [BUGFIX Beta] factoryFor should cache injections when possible --- packages/container/lib/container.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/container/lib/container.js b/packages/container/lib/container.js index a82c2d23381..523512a3971 100644 --- a/packages/container/lib/container.js +++ b/packages/container/lib/container.js @@ -642,10 +642,18 @@ class FactoryManager { this.fullName = fullName; this.normalizedName = normalizedName; this.madeToString = undefined; + this.injections = undefined; } create(options = {}) { - let injections = injectionsFor(this.container, this.normalizedName); + + let injections = this.injections; + if (injections === undefined) { + injections = injectionsFor(this.container, this.normalizedName); + if (areInjectionsDynamic(injections) === false) { + this.injections = injections; + } + } let props = assign({}, injections, options); props[NAME_KEY] = this.madeToString || (this.madeToString = this.container.registry.makeToString(this.class, this.fullName));