`npm run dev` keeps serving old images from `/api/og` after a template change
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
/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) andsrc/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 vitestimport.meta.env.DEVistrue,vi.stubEnv('DEV', false)turns it off, andvi.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 testandnpm run buildpass
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
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de codercops/ogcops
-
good first issue hacktoberfest templates
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Add the Office Hours event template (`event-office-hours`)Peut-être pris @bhushan4work l’a pris aujourd’hui. Ouvertegood first issue hacktoberfest templates
codercops/ogcops#237 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue hacktoberfest templates
Difficulté 3/5 1-2 jours Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Add the Top Episodes podcast template (`podcast-top-episodes`)Peut-être pris @piyusshhjangid l’a pris aujourd’hui. Ouvertegood first issue hacktoberfest templates
codercops/ogcops#226 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Add the Sponsor newsletter template (`newsletter-sponsor`)Peut-être pris @Saumyajaiswal9794 l’a pris aujourd’hui. Ouvertegood first issue hacktoberfest templates
codercops/ogcops#208 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de codercops/ogcops
Issues similaires
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
openclaw/openclaw#182077 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
aikido high security
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markPeut-être pris @eric8810 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: 建议导入源后,自动切换到新导入的源Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
lyswhut/lx-music-desktop#3026 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
abhigyanpatwari/GitNexus#3704 ·
Les mainteneurs répondent en général sous 1 jour