Skip to content

Commit

Permalink
[BUGFIX release-1-13] Ensure that service:store is cleared before r…
Browse files Browse the repository at this point in the history
…eregsitering.

In globals apps, calling `App.reset()` will cause these initializers to
be ran multiple times for each `container` / `registry` instance.  This
means that when `App.reset()` is called, `service:store` is already
registered **AND** resolved, throwing the following error:

```
Cannot re-register: `service:store`, as it has already been resolved.
```

The fix is to `unregister` before `register`ing again.
  • Loading branch information
rwjblue committed Aug 23, 2015
1 parent a476f3f commit 7a70e9a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ember-data/lib/initializers/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ export default function initializeStore(registry, application) {
}

if (store) {
registry.unregister('service:store');
registry.register('service:store', store, { instantiate: false });
} else if (!registry.has('service:store')) {
registry.unregister('service:store');
registry.register('service:store', application && application.Store || Store);
}
}

0 comments on commit 7a70e9a

Please sign in to comment.