Skip to content

Commit

Permalink
fix(router-view): deco typo, lint and missing conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 28, 2016
1 parent bac2309 commit 7de1854
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/route-href.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export class RouteHref {

let href = this.router.generate(this.route, this.params);

if (this.element.au.controller) {
if (this.element.au.controller) {
this.element.au.controller.viewModel[this.attribute] = href;
} else {
this.element.setAttribute(this.attribute, href);
}

return null;
}).catch(reason => {
logger.error(reason);
Expand Down
17 changes: 11 additions & 6 deletions src/router-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class SwapStrategies {

const swapStrategies = new SwapStrategies();

@customElement('
router-view')
@customElement('router-view')
@noView
@inject(DOM.Element, Container, ViewSlot, Router, ViewLocator, CompositionTransaction, CompositionEngine)
export class RouterView {
Expand Down Expand Up @@ -142,7 +141,7 @@ export class RouterView {
});
};

let ready = (owningView)=> {
let ready = owningView => {
viewPortInstruction.controller.automate(this.overrideContext, owningView);
if (this.compositionTransactionOwnershipToken) {
return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(() => {
Expand All @@ -154,13 +153,19 @@ export class RouterView {
return work();
};

if (layoutInstruction && layoutInstruction.viewModel) {
if (layoutInstruction) {
if (!layoutInstruction.viewModel) {
// createController chokes if there's no viewmodel, so create a dummy one
// should we use something else for the view model here?
layoutInstruction.viewModel = {};
}

return this.compositionEngine.createController(layoutInstruction).then(controller => {
ShadowDOM.distributeView(viewPortInstruction.controller.view, controller.slots || controller.view.slots);
controller.automate(createOverrideContext(layoutInstruction.viewModel), this.owningView);
controller.view.children.push(viewPortInstruction.controller.view);
return controller.view || controller;
}).then((newView)=> {
}).then(newView => {
this.view = newView;
return ready(newView);
});
Expand All @@ -177,4 +182,4 @@ export class RouterView {
this.compositionTransactionNotifier = null;
}
}
}
}

0 comments on commit 7de1854

Please sign in to comment.