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

Add Application#reset #1318

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@joliss
Contributor

joliss commented Aug 24, 2012

This is mostly useful for testing.


As discussed with @wycats. Cc @twinturbo, he was interested in this too.

This is working great in my Konacha test suite.

Eventually it may be easier to allow for initialize being run more than once. I.e. #initialize will simply reset the app if it's called a second time. Still, #reset should be a good solution for now.

This pull request includes #1317. You may want to merge that first, because it's a pure cleanup patch. Merged.

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Aug 24, 2012

This pull request passes (merged e21db7e4 into 45ad96d).

travisbot commented Aug 24, 2012

This pull request passes (merged e21db7e4 into 45ad96d).

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Aug 28, 2012

This pull request passes (merged 3a526a6a into 8532f29).

travisbot commented Aug 28, 2012

This pull request passes (merged 3a526a6a into 8532f29).

@travisbot

This comment has been minimized.

Show comment
Hide comment
@travisbot

travisbot Aug 30, 2012

This pull request passes (merged f21a0926 into 72b0f3d).

travisbot commented Aug 30, 2012

This pull request passes (merged f21a0926 into 72b0f3d).

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Sep 10, 2012

Member

It seems like all injections would need reverse injections for destruction. Seems complicated...

Member

wycats commented Sep 10, 2012

It seems like all injections would need reverse injections for destruction. Seems complicated...

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Oct 8, 2012

Contributor

I'm wondering if we can somehow get the application back into the initial state without tearing down everything. So perhaps we can keep the event dispatcher and the applicationView, and just transition the router back into the initial state.

That would obviate the need for a reset method.

Contributor

joliss commented Oct 8, 2012

I'm wondering if we can somehow get the application back into the initial state without tearing down everything. So perhaps we can keep the event dispatcher and the applicationView, and just transition the router back into the initial state.

That would obviate the need for a reset method.

@wagenet

This comment has been minimized.

Show comment
Hide comment
@wagenet

wagenet Oct 8, 2012

Member

@joliss seems like it should be possible to just reset the router.

Member

wagenet commented Oct 8, 2012

@joliss seems like it should be possible to just reset the router.

@ahawkins

This comment has been minimized.

Show comment
Hide comment
@ahawkins

ahawkins Oct 12, 2012

Contributor

@joliss @wagenet what about ember-data things?

Contributor

ahawkins commented Oct 12, 2012

@joliss @wagenet what about ember-data things?

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Oct 12, 2012

Contributor

what about ember-data things?

I'm not entirely sure at the moment. My sense is that since the store is managed by the user (App.store = DS.Store.create ...), the Application has little chance to know how to reset the store.

Contributor

joliss commented Oct 12, 2012

what about ember-data things?

I'm not entirely sure at the moment. My sense is that since the store is managed by the user (App.store = DS.Store.create ...), the Application has little chance to know how to reset the store.

@wagenet

This comment has been minimized.

Show comment
Hide comment
@wagenet

wagenet Oct 12, 2012

Member

@joliss It seems like we could have reset functionality for the store, basically just clearing all of the internal caches. However, that's an ember-data issue so we should probably file it there.

Member

wagenet commented Oct 12, 2012

@joliss It seems like we could have reset functionality for the store, basically just clearing all of the internal caches. However, that's an ember-data issue so we should probably file it there.

@caligo-mentis

This comment has been minimized.

Show comment
Hide comment
@caligo-mentis

caligo-mentis Oct 12, 2012

Contributor

@joliss ember-data register store injection. https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/application_ext.js

So we can describe similar mechanism for reset methods.

Contributor

caligo-mentis commented Oct 12, 2012

@joliss ember-data register store injection. https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/application_ext.js

So we can describe similar mechanism for reset methods.

@wagenet

This comment has been minimized.

Show comment
Hide comment
@wagenet

wagenet Oct 20, 2012

Member

@joliss Looks like this is failing with the new instrumentation stuff.

Member

wagenet commented Oct 20, 2012

@joliss Looks like this is failing with the new instrumentation stuff.

@wagenet

This comment has been minimized.

Show comment
Hide comment
@wagenet

wagenet Oct 20, 2012

Member

Whoops, guessed you fixed it. Had the tab open for too long :)

Member

wagenet commented Oct 20, 2012

Whoops, guessed you fixed it. Had the tab open for too long :)

Add Application#reset
This is mostly useful for testing.
@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Nov 9, 2012

Contributor

I'm closing this. As it is, the Application#reset method has the conceptual issue that it would need to reverse all the injections, and I'm not sure that there's a good solution.

In our test suite, to achieve a reset before each test, we are now simply transitioning the router to the root state. This is not a perfect reset, but it seems good enough.

At some point in the future, we should probably revisit the issue of clean resetting.

Contributor

joliss commented Nov 9, 2012

I'm closing this. As it is, the Application#reset method has the conceptual issue that it would need to reverse all the injections, and I'm not sure that there's a good solution.

In our test suite, to achieve a reset before each test, we are now simply transitioning the router to the root state. This is not a perfect reset, but it seems good enough.

At some point in the future, we should probably revisit the issue of clean resetting.

@joliss joliss closed this Nov 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment