You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using
'''typescript
import DataLoader from 'dataloader'
'''
leads to the error: "TypeError: dataloader_1.default is not a constructor"
at the point where the generateDataLoader function is called.
changing to
'''typescript
import * DataLoader from 'dataloader'
'''
fixes this issue
@@ -61,7 +61,7 @@ export class ResolversModule { }
61
61
### Using the NestDataLoader
62
62
Now that we have a dataloader and our module is aware of it, we need to pass it as a parameter to an endpoint in our graphQL resolver.
63
63
```typescript
64
-
importDataLoaderfrom'dataloader';
64
+
import*asDataLoaderfrom'dataloader';
65
65
import { Loader } from'nestjs-dataloader';
66
66
...
67
67
@@ -78,4 +78,4 @@ export class AccountResolver {
78
78
```
79
79
The important thing to note is that the parameter of the ```@Loader``` decorator is the name of the ```NestDataLoader``` class we want to be injected to the method. The DataLoader library will handle bulk retrieval and caching of our requests. Note that the caching is stored on a per-request basis.
80
80
## Contributing
81
-
Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.
81
+
Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.
0 commit comments