Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

`npm run dev` keeps serving old images from `/api/og` after a template change

Ouverte
#228 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@srujankaleru2007 y travaille déjà.

Depuis le 23/10/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

bug good first issue hacktoberfest

/api/og and /api/templates/<id>/thumbnail.png keep every 200 in caches.default. The comment above that code says the cache doesn't exist in astro dev, but in npm run dev it does: the Cloudflare adapter gives the dev server a caches.default, and it's kept on disk in .wrangler/state/v3/cache.

So if you change a template and reload the same /api/og?template=... URL, you get the old image back, even after restarting the dev server. Add any extra param (&v=2) and the new one shows up. The editor's live preview isn't affected (it renders in the browser), but Download PNG and the gallery thumbnails are.

What to do

  • Skip the cache in dev in both routes, for example import.meta.env.DEV ? undefined : (globalThis.caches ...)?.default
  • Update both comments to match

Where to look

  • src/pages/api/og.ts (lines 15 to 21 and 93) and src/pages/api/templates/[id]/thumbnail.png.ts (lines 11 to 17 and 44)
  • tests/api/og.test.ts, the "OG API error caching" block. In vitest import.meta.env.DEV is true, vi.stubEnv('DEV', false) turns it off, and vi.stubGlobal('caches', { default: { match: vi.fn(), put: vi.fn() } }) gives you a cache to check

Acceptance criteria

  • In dev, neither route reads from or writes to the cache
  • Outside dev, a 200 is still cached like before
  • Tests for both cases, and the dev one fails on the current code
  • npm run check, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #228 in the description.

Langage dominant
TypeScript
Étoiles
8
Forks
4
Merge moyen
5 h 19 min
PR mergées (30 j)
99

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de codercops/ogcops

Toutes les issues de codercops/ogcops

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.