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

fix(core): dependencies not resolving for transient lazy providers #13804

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

patrickacioli
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: Closes #13761

When a lazy module resolver a lazy provider marked as transient the singleton dependencies are recreated for the new requests in same context.

What is the new behavior?

Skipping creation of new providers if they are marked as transient and have annotation in the score of module.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Jul 19, 2024

Pull Request Test Coverage Report for Build ed614f3a-8fae-4c99-8c8e-2e6bfea98225

Details

  • 2 of 3 (66.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 92.198%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/core/injector/module.ts 2 3 66.67%
Totals Coverage Status
Change from base Build 7ea6f01d-9fcc-4d6c-90b4-f217d2306325: -0.01%
Covered Lines: 6748
Relevant Lines: 7319

💛 - Coveralls

Copy link

@Theofilos-Chamalis Theofilos-Chamalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple questions on this PR. This is my first look on this repo so I hope it does not cause any issues!

Thanks and keep up the good work!


sayHello() {
this.counter++;
return 'Hi! Counter is ' + this.counter;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this function here only for debugging purposes or is it actively used? If it is used why not provide a more meaningful message?

Thanks!

const { TransientLazyModule } = await import('./transient.module');
const moduleRef = await this.lazyLoadModule.load(() => TransientLazyModule);

const { TransientService } = await import('./transient.service');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Would it make sense to use Promise.all() or Promise.allSettled() for awaiting these imports in parallel for a slight perf boost?

Thanks!

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

Successfully merging this pull request may close these issues.

Dependencies are not resolved when using lazy load transient providers
5 participants