mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #990] next/image: only fire onError once per image #215
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#215
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (Apr 30, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/990
Upstream change
Next.js fixed
next/imagefiringonErrormultiple times for the same failure in vercel/next.js#93209 (commit 70d9876).Files changed upstream
packages/next/src/client/image-component.tsx(+40 / -22)test/e2e/app-dir/next-image-events/covering thefulfilledandrejectedpaths and assertingonError/onLoadfire exactly onceWhy this matters for vinext
vinext shims
next/image. Whatever event-firing semantics our shim has should match Next.js:onLoadfires once on success,onErrorfires once on failure, and React strict-mode double-invocation or re-render churn must not fire either handler more than once for a single load attempt. User code commonly assumes single-fire semantics for analytics, retry, and fallback logic; firingonErrortwice can double-count failures or cause infinite retry loops.Action
shims/next-image.*(or wherevernext/imageis implemented) for how it tracks load/error state across re-rendersonError(andonLoad) fires at most once persrcper mounttest/e2e/app-dir/next-image-events/— both thefulfilled(success) andrejected(failure) paths, including invalid src, broken URL, and CSP-blocked scenarios as covered upstreamtest/e2e/app-dir/next-image-events/next-image-events.test.tsReferences
github.com/vercel/next.js@70d98765fc