dcramer / peated

https://peated.com
Apache License 2.0
64 stars 13 forks source link

Search Race Conditions #198

Closed dcramer closed 3 months ago

dcramer commented 4 months ago

There's an issue with the way we're relying on debouncing right now for all networked searches.

Basically assume two calbacks (since this is an onKeyUp handler):

This ends up showing the results of t1 when you want t2

dcramer commented 4 months ago

There's two key areas where this problem exists right now:

I've improved both, but they still end up w ith writing outdated results when you're still typing a query. I dont think either has the actual race condition anymore, but keeping this open for now until I fix the entire implementation.

dcramer commented 3 months ago

This is now fixed. Issue was I needed to wrap the callbacks passed into useDebounceCallback with useCallback (or useMemo).

Still want to improve the experience, but it doesnt feel buggy anymore.