Giter Club home page Giter Club logo

Comments (5)

pbakaus avatar pbakaus commented on July 30, 2024

Yes, this is indeed an issue with workbox, as investigated by @jeffposnick in GoogleChrome/workbox#691. I now commented out the code in question, which should fix it for now. Let me know if you're still seeing the behaviour after two reloads.

from samples.

jeffposnick avatar jeffposnick commented on July 30, 2024

I'm not sure what you commented out, but if you try switching from CacheFirst to StaleWhileRevalidate for that feed until we've fixed the underlying bug, you'll end up with reasonable behavior.

from samples.

pbakaus avatar pbakaus commented on July 30, 2024

@jeffposnick sadly I don't think so, as that would mean that a person coming back to the app a few days later will see old stuff, no? Or does staleWhileRevalidate honor the cacheExpiration?

from samples.

jeffposnick avatar jeffposnick commented on July 30, 2024

So even when GoogleChrome/workbox#694 is merged they'll see old stuff on the next visit when using CacheFirst, because we don't have a Date header on the cross-origin response and therefore can't tell synchronously whether the response is fresh or not. The change in that PR will mean that the content will at least get purged in the background for the next visit.

StaleWhileRevalidate along with broadcastCacheUpdate configured to announce changes to the previously cached resource is probably the ideal configuration for this use case—you can listen for that update and then swap in the new content from the context of the page. The use of broadcastCacheUpdate for cross-origin resources also would be a problem, though, because it relies on checking Response headers, and I don't believe the Yahoo! API you're using whitelists the headers it needs...

from samples.

pbakaus avatar pbakaus commented on July 30, 2024

I think I'll do networkFirst instead for now, to keep it fresh and only handle the offline use-case. Thanks for the pointers though, might play around with boradcastCacheUpdate!

from samples.

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.