DEV Community

Discussion on: Caching network requests on the frontend

Collapse
 
yellow1912 profile image
yellow1912

I got around this by issuing another promise. Something hacky like this:

  1. If cache key does not exist, mark that cache key as loading
  2. Start loading, once done then unmark the loading key. Resolve all promises (see below)
  3. If any request (same URL etc) sent within the loading phase, return a promise.