ngneat / cashew

🐿 A flexible and straightforward library that caches HTTP requests in Angular
https://www.netbasal.com
MIT License
685 stars 33 forks source link

fix: empty observable returned when request repeated by subscriber #49

Closed BistroStu closed 3 years ago

BistroStu commented 3 years ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

A manual test for Issue #48 and a fix.

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #48

The demo app and tests did not surface this issue.

What is the new behavior?

The request is deleted from the queue before emitting the response and in the case of an error.

Added a button "Load Serially" to the tools page of the example todos app to test this fix. Watch the console and click the button once. One http request should be sent and the response should be logged twice to the console.

Does this PR introduce a breaking change?

[ ] Yes
[x] No
NetanelBasal commented 3 years ago

I think the solution is fine.

BistroStu commented 3 years ago

I have updated my pull request description and included the bug fix. I cleaned up the manual test and left it in the example app.