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
Hi @sreeharsha-rav, thanks for reaching out.
I understand where you are coming from, but I don't think this is a change worth introducing in here: as much as the changes would make the implementation more robust, the point of this project is educational and not to create a drop in replacement for lodash.
The proposed changes complicate the script significantly, making it harder to read and, potentially, to understand.
I made a point of trying to keep the implementations as simple as possible, at the cost of some edge cases, and I think this one falls in that category.
Issue
Does not handle uncaught awaited promises well. https://github.com/cedmax/youmightnotneed/blob/production/src/content/lodash/function/debounce/vanilla.js
Use case
using debounce for making asynchronous calls for a weather API.
Problem
Does not handle uncaught promises well:
Using debounce in
async fetchData
below:Current debounce function ported from vanilla JS:
Suggested changes
Add an array of resolves to handle uncaught await promises.
Since above code is in typescript, equivalent code in js is:
The text was updated successfully, but these errors were encountered: