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

Singleton providers leak non-singleton dependencies #42

Open
guyca opened this issue Jan 5, 2022 · 0 comments
Open

Singleton providers leak non-singleton dependencies #42

guyca opened this issue Jan 5, 2022 · 0 comments
Labels
bug Something isn't working future

Comments

@guyca
Copy link
Collaborator

guyca commented Jan 5, 2022

In the following example, useCase is retained throwout the lifespan of all PushedScreenGraphinstances, while presenter is meant to be retained only for the lifespan of the PushedScreen component this graph instance is bound to.

@Graph()
class PushedScreenGraph {
  @Provides()
  presenter(): PushedScreenPresenter {
    return new PushedScreenPresenter();
  }

  @Provides() @Singleton()
  someUseCase(presenter: PushedScreenPresenter): SomeUseCase {
    return new SomeUseCase(presenter);
  }
}
@guyca guyca added bug Something isn't working good first issue Good for newcomers labels Jan 5, 2022
@guyca guyca added future and removed good first issue Good for newcomers labels Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working future
Projects
None yet
Development

No branches or pull requests

1 participant