kmoskwiak / useSSE

use Server-Side Effect ✨in React SSR app
https://kspr.dev/use-sse/
MIT License
139 stars 10 forks source link

Race condition #22

Open mssalnikov opened 3 years ago

mssalnikov commented 3 years ago

I'm not sure, maybe I'm doing something wrong, but I've used useSSE hook twice in my app, and now data object unpredictably has my requests results in different order and components receive wrong data.

Judging by the code, the requests are simply inserted in the array as they come, and my code renders asynchronously, so the order of request calls is undetermined.

I've found this repo through this article, and there results are kept by keywords. Is there a reason this idea was abandoned? I'd be more than happy to support each request with some data key, it would be almost like using redux.