BJS-kr / nestjs-omacache

flexible, powerful and simple caching strategy using decorators for NestJS
86 stars 4 forks source link

Handle null parameters value #6

Closed mandarvl closed 7 months ago

mandarvl commented 7 months ago

I have this method in my controller :

@InMemoryCache({
    key: 'facilities',
    kind: 'temporal',
    ttl: 60 * 60 * 10,
    paramIndex: [0]
 })
async loadData(@Query('someParam') param?: number) {
 ...
}

The problem is that when userId is null (or undefined), it throw this error : TypeError : The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null

Is it possible to allow optional parameters ?

BJS-kr commented 7 months ago

Of course! I think recent update brought this bug. I'll fix it

BJS-kr commented 7 months ago

once you update package version to 1.0.5, you'll get fixed package. thanks for contribution!

mandarvl commented 7 months ago

Thank you, will try it asap!