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

Use Cache Storage API to Cache Images #517

Closed
stravid87 opened this issue Aug 14, 2024 · 1 comment
Closed

Use Cache Storage API to Cache Images #517

stravid87 opened this issue Aug 14, 2024 · 1 comment
Assignees
Labels
Difficulty: Intermediate Intermediate level Type: Enhancement Enhancement to existing feature
Milestone

Comments

@stravid87
Copy link
Collaborator

stravid87 commented Aug 14, 2024

Description
Line 13 of Index.vue and and Line 31 of ItemCard.vue illustrate the problem:

          <q-img
            loading="lazy"
            decoding="async"
            fetchpriority="low"
            :src="monthPrompt?.image"
            spinner-color="primary"
            style="border: 3px solid #e54757; border-radius: 12px"
            data-test="month-link"
            @load="loaded = true"
            :class="{ 'prompt-img': loaded }"
            :srcset="`${monthPrompt?.image} 2x`"
            sizes="(max-width: 560) 50vw, 100vw"
          />
    <router-link v-if="!item.isAdd" :to="link" class="col-4 text-primary">
      <q-img :ratio="1" :src="item.image" style="border-radius: 24px" @click="goToUrl()" />
    </router-link>

In both scenarios, the image must be retrieved through calls to the backend hosting service. However, if these images can be cached, then far fewer requests will go through.

The Cache Storage API is for the caching of requests and responses seems an appropriate choice on which to build this functionality.

Acceptance Criteria
When a user first loads the IndexPage.vue, the hero image is loaded & cached.
On reload, the image is retrieved from the cache.
Time-To-Live should be set to 10days (3 reloads per month which is the length of a competition.)

@marclupanc
Copy link
Collaborator

Done in - #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Intermediate Intermediate level Type: Enhancement Enhancement to existing feature
Development

No branches or pull requests

4 participants