ngneat / elf

🧙‍♀️ A Reactive Store with Magical Powers
https://ngneat.github.io/elf/
MIT License
1.62k stars 93 forks source link

trackRequestResult with staleTime and preventConcurrentRequest doesn't prevent concurrent requests #485

Closed citruspress closed 1 year ago

citruspress commented 1 year ago

Which @ngneat/elf-* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

Using trackRequestResult along with staleTime doesn't immediately prevent concurrent requests.

I have a failing test here: https://github.com/citruspress/elf/commit/86cd66067069a2aee623f0b99f5b1b5de5f859d1

I would be happy to have a look at this but just wanted to check if you had anyone else had any thoughts or input before.

I suspect the request is stale which is why concurrent requests can occur.

Please provide a link to a minimal reproduction of the bug

https://github.com/citruspress/elf/commit/86cd66067069a2aee623f0b99f5b1b5de5f859d1

Please provide the exception or error you saw

In our application using elf, we sometimes se multiple requests when we've specified a stale time.

Please provide the environment you discovered this bug in

"@ngneat/elf-requests": "1.9.1",

Anything else?

No response

Do you want to create a pull request?

Yes

NetanelBasal commented 1 year ago

You're welcome to create a PR