Skip to content

Commit

Permalink
Fix runtime error in FastBoot
Browse files Browse the repository at this point in the history
  • Loading branch information
mhluska committed Jun 6, 2018
1 parent 566dd62 commit 5436cc8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/initializers/ember-form-for-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import Ember from 'ember';
const { getOwner } = Ember;

export function initialize(app) {
let i18n = null;

try {
i18n = getOwner(app).lookup('service:i18n');
} catch(e) {
i18n = app.__container__.lookup('service:i18n');
// HACK: This can be undefined in the FastBoot environment.
const owner = getOwner(app) || app.__container__;
if (!owner) {
return;
}

if (i18n) {
app.inject('component', 'i18n', 'service:i18n');
const i18n = owner.lookup('service:i18n');
if (!i18n) {
return;
}

app.inject('component', 'i18n', 'service:i18n');
}

export default {
Expand Down

0 comments on commit 5436cc8

Please sign in to comment.