Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refetch #6

Open
sysmat opened this issue Oct 29, 2023 · 0 comments
Open

refetch #6

sysmat opened this issue Oct 29, 2023 · 0 comments

Comments

@sysmat
Copy link

sysmat commented Oct 29, 2023

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant