`npm run dev` keeps serving old images from `/api/og` after a template change
メンテナーはふだん 1 日以内に返信
@srujankaleru2007 がすでに取り組んでいます。
2026年10月23日 から。
評価
この issue はまだ評価されていません。
説明
/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.
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 4
- 平均マージ
- 5時間 19分
- マージ済み PR(30日)
- 99
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/ogcops のほかの issue
-
good first issue hacktoberfest templates
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Add the Office Hours event template (`event-office-hours`)対応中かも @bhushan4work が今日担当しました。 オープンgood first issue hacktoberfest templates
codercops/ogcops#237 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
good first issue hacktoberfest templates
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Add the Top Episodes podcast template (`podcast-top-episodes`)対応中かも @piyusshhjangid が今日担当しました。 オープンgood first issue hacktoberfest templates
codercops/ogcops#226 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Add the Sponsor newsletter template (`newsletter-sponsor`)対応中かも @Saumyajaiswal9794 が 1 日前に担当しました。 オープンgood first issue hacktoberfest templates
codercops/ogcops#208 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
codercops/ogcops の issue をすべて見る
似ている issue
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefix対応中かも @ItsDeadlyProgrammer が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
appsmithorg/appsmith#42471 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ehmpathy/rhachet-roles-bhrain#705 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Status: Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
mermaid-js/mermaid#8546 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
メンテナーはふだん 1 日以内に返信