Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
krisselden authored and rwjblue committed Oct 27, 2017
1 parent 1457111 commit 29689a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions packages/ember-glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default class Environment extends GlimmerEnvironment {
name: string;
source: string;
owner: Container;
}, CurlyComponentDefinition>;
}, CurlyComponentDefinition | undefined>;
private _templateCache: Cache<{
Template: WrappedTemplateFactory | OwnedTemplate;
owner: Container;
Expand All @@ -124,14 +124,17 @@ export default class Environment extends GlimmerEnvironment {
this._definitionCache = new Cache(2000, ({ name, source, owner }) => {
let { component: componentFactory, layout } = lookupComponent(owner, name, { source });
let customManager: any;
if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
let managerId = layout && layout.meta.managerId;
if (componentFactory || layout) {
if (GLIMMER_CUSTOM_COMPONENT_MANAGER) {
let managerId = layout && layout.meta.managerId;

if (managerId) {
customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
if (managerId) {
customManager = owner.factoryFor<any>(`component-manager:${managerId}`).class;
}
}
return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
}
return new CurlyComponentDefinition(name, componentFactory, layout, undefined, customManager);
return undefined;
}, ({ name, source, owner }) => {
let expandedName = source && this._resolveLocalLookupName(name, source, owner) || name;

Expand Down Expand Up @@ -216,7 +219,9 @@ export default class Environment extends GlimmerEnvironment {
let source = moduleName && `template:${moduleName}`;
let definition = this._definitionCache.get({ name, source, owner });
finalizer();
return definition;
// TODO the glimmer-vm wants this to always have a def
// but internally we need it to sometimes be undefined
return definition!;
}

// normally templates should be exported at the proper module name
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-views/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const ViewStateSupport: any;
export const TextSupport: any;

export function getViewElement(view: Opaque): Element;
export function setViewElement(view: Opaque, element: Element);
export function setViewElement(view: Opaque, element: Element | null);

export function isSimpleClick(event: Event): boolean;

Expand Down

0 comments on commit 29689a3

Please sign in to comment.