Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#228 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@srujankaleru2007 がすでに取り組んでいます。

2026年10月23日 から。

評価

この issue はまだ評価されていません。

説明

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.

主要言語
TypeScript
スター
8
フォーク
4
平均マージ
5時間 19分
マージ済み PR(30日)
99

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codercops/ogcops のほかの issue

codercops/ogcops の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。