Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Change the default value of the `cachePromiseRejection` option to `true` #36
As a feature, this already feels weird because caching depends on this specific mechanism and not others like:
Having it avoid cache just because a promise is rejected feels arbitrary... but in a way I see that it's a flexible mechanism that allows any function (sync or async) to decide whether to avoid the cache.
That said, I don't think it should be a default, because:
I was unaware of this behavior until Sindre tweeted about it.
I really don't see what memoization has to do with promises altogether. Therefore, I also don't see why the option even exists, let alone why it has an unintuitive default.
At most, I would expect if from a hypothetical
If you keep this behavior, please make it more clear in the readme.
That's not a bad point, actually, since https://github.com/sindresorhus/p-memoize exists and is promise-specific. However as I said in my first post:
referenced this pull request
May 15, 2019
Sorry for the short response
On the one hand, you could argue that since it doesn't
That being said, I think that it becomes quite "magic" when it removes
It just seems like which behavior you want is very usage-dependent, and it's impossible to pick a perfect default. Therefore I think that the less "magic" way should be the default, as not to accidentally opt people into something they might not be aware of. Just my 2¢
I also agree with this, I think that this package shouldn't deal with promises at all, since we have
Yeah, maybe, but I'll keep it for now as