subscribe icon indicating copy to clipboard operation
subscribe copied to clipboard

refetch

Open sysmat opened this issue 1 year ago • 0 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[X] Support request
[ ] Other... Please describe:

Current behavior

  • When using refetch() from UseQuery subscribe don't get new subscriber from result$

Expected behavior

after refetch to have isLoading, ... in subscriber

Minimal reproduction of the problem with instructions

<ng-container *subscribe="mail$.result$ as query">
      <div *ngIf="query.isLoading">
      <iconify-icon icon="svg-spinners:12-dots-scale-rotate" style="color: green"></iconify-icon>
        loading...
      </div>            
      <div *ngIf="query.isError">napaka pri prodobivanju maila</div>      
      <div *ngIf="query.data">mailto: {{ query.data.entity  }}</div>      
    </ng-container>
    <iconify-icon icon="oi:reload" (click)="retch()" style="cursor: pointer; color: green"></iconify-icon>
mail$ = this.infoService.getMail();

  retch() {
    this.mail$.refetch();
  }
getAdminMail(): Observable<Resp> {
    return this.#http.get<Resp>('api/mail/admin');
  }

getMail() {
    return this.#useQuery(['mail'], () => this.getAdminMail());
  }

What is the motivation / use case for changing the behavior?

To trigger re fetch and have newer data

Environment


Angular version: 16.2.11


Browser:
- [x] Chrome (desktop) version 118.0.5993.118 
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: v18.18.2
- Platform:  Windows 11
- "@ngneat/query": "^1.0.0",
- "@ngneat/subscribe": "^4.0.0",

Others:

sysmat avatar Oct 29 '23 14:10 sysmat