Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX canary] Decouple route transition from view creation #10372

Merged
merged 1 commit into from
Feb 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/ember-application/lib/system/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ArrayController from "ember-runtime/controllers/array_controller";
import Renderer from "ember-views/system/renderer";
import DOMHelper from "dom-helper";
import SelectView from "ember-views/views/select";
import { OutletView } from "ember-routing-views/views/outlet";
import EmberView from "ember-views/views/view";
import _MetamorphView from "ember-views/views/metamorph_view";
import EventDispatcher from "ember-views/system/event_dispatcher";
Expand Down Expand Up @@ -1003,6 +1004,7 @@ Application.reopenClass({

registry.injection('view', 'renderer', 'renderer:-dom');
registry.register('view:select', SelectView);
registry.register('view:-outlet', OutletView);

registry.register('view:default', _MetamorphView);
registry.register('view:toplevel', EmberView.extend());
Expand All @@ -1011,6 +1013,7 @@ Application.reopenClass({
registry.register('event_dispatcher:main', EventDispatcher);

registry.injection('router:main', 'namespace', 'application:main');
registry.injection('view:-outlet', 'namespace', 'application:main');

registry.register('location:auto', AutoLocation);
registry.register('location:hash', HashLocation);
Expand Down
5 changes: 3 additions & 2 deletions packages/ember-application/tests/system/logging_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Controller from "ember-runtime/controllers/controller";
import Route from "ember-routing/system/route";
import RSVP from "ember-runtime/ext/rsvp";
import keys from "ember-metal/keys";
import compile from "ember-template-compiler/system/compile";

import "ember-routing";

Expand Down Expand Up @@ -182,7 +183,7 @@ QUnit.test("log when template and view are missing when flag is active", functio
return;
}

App.register('template:application', function() { return ''; });
App.register('template:application', compile("{{outlet}}"));
run(App, 'advanceReadiness');

visit('/posts').then(function() {
Expand Down Expand Up @@ -210,7 +211,7 @@ QUnit.test("log which view is used with a template", function() {
return;
}

App.register('template:application', function() { return 'Template with default view'; });
App.register('template:application', compile('{{outlet}}'));
App.register('template:foo', function() { return 'Template with custom view'; });
App.register('view:posts', View.extend({ templateName: 'foo' }));
run(App, 'advanceReadiness');
Expand Down
15 changes: 2 additions & 13 deletions packages/ember-routing-htmlbars/lib/helpers/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/

import Ember from "ember-metal/core"; // assert
import { set } from "ember-metal/property_set";
import { OutletView } from "ember-routing-views/views/outlet";

/**
The `outlet` helper is a placeholder that the router will fill in with
Expand Down Expand Up @@ -71,7 +69,6 @@ import { OutletView } from "ember-routing-views/views/outlet";
@return {String} HTML string
*/
export function outletHelper(params, hash, options, env) {
var outletSource;
var viewName;
var viewClass;
var viewFullName;
Expand All @@ -83,11 +80,6 @@ export function outletHelper(params, hash, options, env) {

var property = params[0] || 'main';

outletSource = this;
while (!outletSource.get('template.isTop')) {
outletSource = outletSource._parentView;
}
set(this, 'outletSource', outletSource);

// provide controller override
viewName = hash.view;
Expand All @@ -105,11 +97,8 @@ export function outletHelper(params, hash, options, env) {
);
}

viewClass = viewName ? this.container.lookupFactory(viewFullName) : hash.viewClass || OutletView;

hash.currentViewBinding = '_view.outletSource._outlets.' + property;

viewClass = viewName ? this.container.lookupFactory(viewFullName) : hash.viewClass || this.container.lookupFactory('view:-outlet');
hash._outletName = property;
options.helperName = options.helperName || 'outlet';

return env.helpers.view.helperFunction.call(this, [viewClass], hash, options, env);
}
Loading