Skip to content

Commit b756d65

Browse files
docs(scopes): explain request provider scope (and its bubbling) #2945
1 parent b1bb3e2 commit b756d65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/fundamentals/provider-scopes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Transient-scoped dependencies don't follow that pattern. If a singleton-scoped `
8080

8181
In an HTTP server-based application (e.g., using `@nestjs/platform-express` or `@nestjs/platform-fastify`), you may want to access a reference to the original request object when using request-scoped providers. You can do this by injecting the `REQUEST` object.
8282

83-
The `REQUEST` provider is request-scoped, so you don't need to explicitly use the `REQUEST` scope in this case.
83+
The `REQUEST` provider is inherently request-scoped, meaning you don't need to specify the `REQUEST` scope explicitly when using it. Additionally, even if you attempt to do so, it will be disregarded. Any provider that relies on a request-scoped provider automatically adopts a request scope, and this behavior cannot be altered.
8484

8585
```typescript
8686
import { Injectable, Scope, Inject } from '@nestjs/common';
@@ -209,7 +209,7 @@ return {
209209
resolve: (info: HostComponentInfo) =>
210210
info.isTreeDurable ? tenantSubTreeId : contextId,
211211
payload: { tenantId },
212-
}
212+
};
213213
```
214214

215215
Now whenever you inject the `REQUEST` provider (or `CONTEXT` for GraphQL applications) using the `@Inject(REQUEST)`/`@Inject(CONTEXT)`, the `payload` object would be injected (consisting of a single property - `tenantId` in this case).

0 commit comments

Comments
 (0)