Debounce and Cancel In-flight Requests in React Using Effect Streams
Heya! I was encouraged to post here by Michael from a twitter post I made earlier today.
I'm looking at a way to debounce and cancel inflight requests while typing in a text input. I have an implementation that interrupts a fiber and I keep a reference of it using a React
Here's a stackblitz with simpler but working solution https://stackblitz.com/edit/vitejs-vite-ekkpav?file=src%2FApp.tsx — Hopefully this explains what I'm trying to do.
Thanks!
I'm looking at a way to debounce and cancel inflight requests while typing in a text input. I have an implementation that interrupts a fiber and I keep a reference of it using a React
ref but I was suggested we could be using Stream for that. I've only been scratching the surface of effect so I'm not too sure how I would use stream, any pointers that'd help me? I'm used to use Observables for these and it works great (switchMap) but I wanted to avoid having to depend on them.Here's a stackblitz with simpler but working solution https://stackblitz.com/edit/vitejs-vite-ekkpav?file=src%2FApp.tsx — Hopefully this explains what I'm trying to do.
Thanks!
