Skip to content

refetch #6

@sysmat

Description

@sysmat

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions