fix(nuxt-img): swap from placeholder when decode() fails on a loaded image - #2314
fix(nuxt-img): swap from placeholder when decode() fails on a loaded image#2314chairulakmal wants to merge 1 commit into
decode() fails on a loaded image#2314Conversation
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe image decode rejection handler now distinguishes successfully completed images from failed images. Completed images with a positive natural width update placeholder state and emit Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized image-loading fix changes how decode failures are handled and adds coverage for the affected branches; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f95cae2 to
7a007e9
Compare
decode fails on a loaded image
decode fails on a loaded imagedecode() fails on a loaded image
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2314 +/- ##
==========================================
+ Coverage 32.61% 34.13% +1.51%
==========================================
Files 7 7
Lines 371 375 +4
Branches 131 132 +1
==========================================
+ Hits 121 128 +7
+ Misses 194 191 -3
Partials 56 56 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
decode() fails on a loaded imagedecode() fails on a loaded image
🔗 Linked issue
fixes #2130
📚 Description
<NuxtImg placeholder>stays blurred forever whendecode()rejects: the catch emits error and never setsplaceholderLoaded. Chromium rejectsdecode()for images it can still display (crbug 40261318).I now treat a rejection as a failure only when the image itself failed to load, via
img.complete && img.naturalWidth > 0. I also added a mock and a test per branch as this path was untested;Imagehas no decode.