trackRequestResult & angular guard not returning cached data #509
Unanswered
UnleashSpirit
asked this question in
Q&A
Replies: 2 comments
-
But EMPTY completes the observable - https://github.com/ReactiveX/rxjs/blob/master/packages/rxjs/src/internal/observable/empty.ts#L65 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I guess the issue is that it doesn't return a boolean |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Which @ngneat/elf-* package(s) are the source of the bug?
requests-status, requests-cache
Is this a regression?
No
Description
Hi,
We just begin to use elf (instead of akita) for a simple need of cache (store will come later).
In our case we have a route behind a canActivate Guard.
If we use trackRequestResult with cacheResponseData: true, the next call to the request return an EMPTY Observable.
This appears to be because the query never trigger the 'complete' state so we got nothing from this code :
We go in cause
if
return true but got nothing causefilter((requestResult) => requestResult.fetchStatus === 'idle'
emit nothing.Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
A component behind a route with canActivate guard
In this guard use the service to call the API request (the switch hide business logic, simplified here)
In the component, call the same request
The component never get the cached data (done by the guard)
Anything else?
We override the request-result.ts fro mthe lib and it seems that the query from the guard never goes through the
complete
here :We have the
next
and thefinalize
(we had it) but never the complete.If we subscribe in the guard instead of returning it, it seems to work.
No solution found till now for us.
Do you want to create a pull request?
No
Beta Was this translation helpful? Give feedback.
All reactions