Skip to content

Commit

Permalink
Merge pull request #6827 from Connormiha/optimize-sort-by-identifier
Browse files Browse the repository at this point in the history
Save identifier module after first getting
  • Loading branch information
sokra committed Mar 29, 2018
2 parents 1b50e4e + 9012ab9 commit f600ccd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/ContextModule.js
Expand Up @@ -43,6 +43,8 @@ class ContextModule extends Module {

if (typeof options.mode !== "string")
throw new Error("options.mode is a required option");

this._identifier = this._createIdentifier();
}

updateCacheModule(module) {
Expand All @@ -69,7 +71,7 @@ class ContextModule extends Module {
.join("!");
}

identifier() {
_createIdentifier() {
let identifier = this.context;
if (this.options.resourceQuery)
identifier += ` ${this.options.resourceQuery}`;
Expand All @@ -86,6 +88,10 @@ class ContextModule extends Module {
return identifier;
}

identifier() {
return this._identifier;
}

readableIdentifier(requestShortener) {
let identifier = requestShortener.shorten(this.context);
if (this.options.resourceQuery)
Expand Down
5 changes: 4 additions & 1 deletion lib/MultiModule.js
Expand Up @@ -15,10 +15,13 @@ class MultiModule extends Module {
// Info from Factory
this.dependencies = dependencies;
this.name = name;
this._identifier = `multi ${this.dependencies
.map(d => d.request)
.join(" ")}`;
}

identifier() {
return `multi ${this.dependencies.map(d => d.request).join(" ")}`;
return this._identifier;
}

readableIdentifier(requestShortener) {
Expand Down

0 comments on commit f600ccd

Please sign in to comment.