-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
ConfigurableModuleBuilder "alwaysTransient: false" (@default) doesn't work #13076
Comments
isn't this pretty much what the docs of nest/packages/common/module-utils/configurable-module.builder.ts Lines 35 to 42 in 3141a1e
|
Well, here's the thing though, the expected behavior I described is not really documented, but is clearly mentioned in one of the official nestjs courses. What I'm saying is that, |
The version used in the course seems to be |
@StiliyanKushev yeah, got you please feel free to improve the docs at https://github.com/nestjs/docs.nestjs.com the version shouldn't matter here |
Well, I'm a bit worried that this is an issue? Either a bug, or outdated course information, but the fact it worked differently before makes me believe it's the former. Just to recap, the course suggests that the above logs should execute 3 times (due to all provders instantiating because of the different internal hashes or whatever), however (on the latest nest version at least) it only executes once unless you specifically enable |
That's the correct video you're referencing, but it's the wrong timestamp. |
ok, I just saw what you're talking about but please share a minimum reproduction as well |
Okay, I'll make a repo in a minute. I can also test with different nest versions and will report up until what version it works as expected. |
check out the https://github.com/nestjs/nest/releases I don't think that that behavior have changed but I can be wrong |
Yeah, already searched in the releases, wasn't mentioned. (Another reason I suspect this to be a bug). |
Here you go, hope that's enough :) |
seems to be a regression introduced on |
@micalevisk Yeah, this is a bug introduced by my PR, That piece of code worked before because we used those objects to differentiate each module, if he use the async version, then it will have the same issue. We can basically revert the change for that module only, the easiest/quickest fix, the other changes we don't need to revert. We can also go back to the conversation started at #12898, this issue could be fixed using that feature. |
Great! Additionally I'd say this can be better documented for future reference as to me it seems to be a somewhat crucial feature in certain scenarios. |
Would you like to create a PR for this? |
Is there an existing issue for this?
Current behavior
The console log is printed only once, unless alwaysTransient is set to true.
Steps to reproduce
No response
Expected behavior
Expecting the console log to run 3 times because the options are different in the providers array (as stated in the official nestjs advanced concepts course).
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
10.3.0
Packages versions
Node.js version
v20.8.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: