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 release-1-13] Ensure that service:store is cleared before regsitering. #3690

Merged
merged 1 commit into from
Sep 10, 2015

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Aug 23, 2015

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 registering again.

Fixes emberjs/ember.js#10310.


Please note, this is already a non-issue in 2.0.0 (aka release branch). This PR is targeting the release-1-13 branch (which was branched from the v1.13.11 tag).

…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.
@bmac
Copy link
Member

bmac commented Aug 23, 2015

@rwjblue In the 2.0 branch the initializer is using has to check if the store is already registered. Which I suspect is the reason this is not an issue with the 2.0 branch. Could this lead to some subtle sate bugs in 2.0 if an old store is not unregistered when calling App.reset()?

if (!has(registry, 'service:store')) {
registry.register('service:store', Store);
}

@rwjblue
Copy link
Member Author

rwjblue commented Aug 23, 2015

I am unsure, but it seems possible. I'll try to get us some tests here so we can confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants