Giter VIP home page Giter VIP logo

Comments (5)

NetanelBasal avatar NetanelBasal commented on June 22, 2024

Create a reproduction in stackblitz, please.

from cashew.

sydneyhenrard avatar sydneyhenrard commented on June 22, 2024

Stackblitz: https://stackblitz.com/edit/angular-ivy-bajvyj?file=src/app/league/league.service.ts

If you set cache$ to true it's not working, if you set it to false it's working.
Use the following URL to test: https://angular-ivy-bajvyj.stackblitz.io/leagues/a/b

from cashew.

NetanelBasal avatar NetanelBasal commented on June 22, 2024

The issue is only with useHttpCacheLocalStorage?

from cashew.

sydneyhenrard avatar sydneyhenrard commented on June 22, 2024

No the issue is also when using in memory cache. I also tried to remove the guard, it's working. Same thing with only the resolve. So it seems that it's the combination of guard and resolve with both using a cached HTTP request.

from cashew.

WilliamChelman avatar WilliamChelman commented on June 22, 2024

If that can help, I encountered a very similar issue. The only difference is that there is no resolver in my case, just a guard and a component making the same cached call trough a dedicated service. That component is part of a Route config too.

The quick fix I currently have is to add a delay(0) just before the actual cached http call, so that they all skip a frame and that seems to do it for some reason 😅

@Injectable()
export class MyService {
  // ...

  fetchCats() {
    return this.getSomeUrlFromAConfigFile().pipe(
      delay(0),
      switchMap(url => this.http.post<Cat[]>(url, {}, withCache()))
    );
  }
}

To be noted that we use a custom KeySerializer to be able to cache POST queries with a body, but I don't think it plays any part in this. I guess that a timer(0) would also do the trick.

from cashew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.