Skip to content

docs: clarify lifecycle events #3281

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheCoreMan
Copy link

I stumbled upon this in https://www.mrnice.dev/posts/nestjs-lifecycle/ and it confused me and my teammates. Thought it would be useful to clarify this

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
  • Docs
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This is my first contrib to NestJS - tried to follow the guidelines, hoping I didn't miss anything. This was just a docs change so just did everything as quickly as possible from the web interface on GitHub

I stumbled upon this in https://www.mrnice.dev/posts/nestjs-lifecycle/ and it confused me and my teammates. Thought it would be useful to clarify this
@@ -18,7 +18,7 @@ In the following table, `onModuleDestroy`, `beforeApplicationShutdown` and `onAp

| Lifecycle hook method | Lifecycle event triggering the hook method call |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onModuleInit()` | Called once the host module's dependencies have been resolved. |
| `onModuleInit()` | Called once the host module's dependencies have been resolved. "Once" meaning called AFTER the host module's dependencies have been resolved, but not necessarily one time only. |
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if I'm following. This hook is called one time only per each provider that implements it. The change you suggested ("not necessarily one time only") may lead someone to think that it might be called several times for the same provider (which isn't true). Correct me if I'm wrong

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