Skip to content

Commit

Permalink
fix(resource-coordinator): regression in local auto-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Feb 13, 2015
1 parent e0e3703 commit 8ec0909
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/resource-coordinator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@ export class ResourceCoordinator {
this.container = container;
this.viewEngine = viewEngine;
this.importedModules = {};
this.importedAnonymous = {};
this.appResources = appResources;
viewEngine.resourceCoordinator = this;
}

getExistingModuleAnalysis(id){
return this.importedModules[id];
return this.importedModules[id] || this.importedAnonymous[id];
}

loadViewModelInfo(moduleImport, moduleMember){
return this._loadAndAnalyzeModuleForElement(moduleImport, moduleMember);
return this._loadAndAnalyzeModuleForElement(moduleImport, moduleMember, this.importedAnonymous, true);
}

loadElement(moduleImport, moduleMember, viewStategy){
return this._loadAndAnalyzeModuleForElement(moduleImport, moduleMember, this.importedModules).then(info => {
return this._loadAndAnalyzeModuleForElement(moduleImport, moduleMember, this.importedModules, false).then(info => {
var type = info.type;

if(type.isLoaded){
Expand All @@ -48,8 +49,8 @@ export class ResourceCoordinator {
});
}

_loadAndAnalyzeModuleForElement(moduleImport, moduleMember, cache){
var existing = cache && cache[moduleImport];
_loadAndAnalyzeModuleForElement(moduleImport, moduleMember, cache, skipCacheLookup){
var existing = !skipCacheLookup && cache[moduleImport];

if(existing){
return Promise.resolve(existing.element);
Expand Down Expand Up @@ -77,9 +78,7 @@ export class ResourceCoordinator {
}
}

if(cache){
cache[analysis.id] = analysis;
}
cache[analysis.id] = analysis;

return Promise.all(loads).then(() => analysis.element);
});
Expand Down

0 comments on commit 8ec0909

Please sign in to comment.