Comments (20)
That's the correct video you're referencing, but it's the wrong timestamp.
I can provide the screenshots in a sec.
from nest.
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.
from nest.
Yeah, already searched in the releases, wasn't mentioned. (Another reason I suspect this to be a bug).
from nest.
Here you go, hope that's enough :)
from nest.
Notice that it works as expected if I downgrade to version 9 for example.
from nest.
Actually, seems to be a semi-recent bug in the latest version of @nestjs/[email protected]
.
EDIT: yeah
from nest.
@micalevisk Yeah, this is a bug introduced by my PR, alwaysTransient
works because of: https://github.com/nestjs/nest/pull/12753/files#diff-22f1ab07f43abbd45f270de55b6cd35da90c02fe92cee99f67d51a37b85002c8R209-R220 which makes the module unique.
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.
from nest.
from nest.
isn't this pretty much what the docs of alwaysTransient
says here:
nest/packages/common/module-utils/configurable-module.builder.ts
Lines 35 to 42 in 3141a1e
from nest.
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, alwaysTransient
set to true
actually works as expected, but when set to false
(by default), it supposedly (as shown in the course) should still act as if alwaysTransient
is set to true
for providers that are the same but have different options passed (such as in my example), due to their "internal hash" being different.
from nest.
The version used in the course seems to be v7.1.2
(edit: maybe they upgraded versions between lessons, not entirely sure)
from nest.
@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
from nest.
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 alwaysTransient
.
from nest.
Just to recap, the course suggests that the above logs should execute 3 times
are you sure?
from nest.
from nest.
ok, I just saw what you're talking about
but please share a minimum reproduction as well
from nest.
check out the https://github.com/nestjs/nest/releases
I don't think that that behavior have changed but I can be wrong
from nest.
seems to be a regression introduced on @nestjs/[email protected]
from nest.
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.
from nest.
We can basically revert the change for that module only, the easiest/quickest fix, the other changes we don't need to revert.
Would you like to create a PR for this?
from nest.
Related Issues (20)
- Nested routes in NestJS are confused with parameters HOT 1
- Custom TypeORM Repository undefined in NestJS integration tests HOT 6
- Global Guards are not triggered when route is registered with httpService.get('/route`) HOT 3
- WebSocket response not received when returning a json object HOT 1
- Inconsistent Route Matching in NestJS Based on Route Declaration Order HOT 10
- Including TypeORM migration in monorepo application HOT 1
- Injected @Body in POST request handler is `undefined` HOT 17
- @Body transform issue: The `metatype` property of the 2nd Arg to ValidationPipe.transform(v, metadata) is `undefined` during jest e2e `supertest` run. HOT 8
- MODULE_OPTIONS_TOKEN can not be resolved in Pipe HOT 1
- mongo transaction cannot work well HOT 1
- Unable to get collection stats() HOT 1
- Cannot extend `ValidationPipe` properly HOT 1
- Not able to use ESM node packages. HOT 1
- TCP microservice does NOT have a max message length HOT 6
- Fastify with TypeORM with @Body() undefined HOT 7
- Options property inboxPrefix not implemented in ClientNats HOT 1
- ValidationPipe does not support index.ts file importing HOT 2
- `UploadFile()` should accept `Readable` instead of `Buffer` HOT 5
- @UploadFiles Decorator Not Working As Expected HOT 1
- ClassSerializerInterceptor misses groups when using options.type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nest.