Skip to content

Singleton providers leak non-singleton dependencies #42

Open
@guyca

Description

@guyca

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);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfuture

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions