Conversation
Signed-off-by: prxt6529 <prxt@6529.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughIntroduces an Arweave fallback mechanism: a new utility rewrites Arweave URLs to ar-io.net on media error, image/video renderers use this wrapper for onError handling, and Next.js image config adds ar-io.net to remotePatterns. Changes
Sequence DiagramsequenceDiagram
participant MediaEl as NFT Media Element
participant Handler as withArweaveFallback Handler
participant Utils as Arweave Utils
participant FallbackHost as ar-io.net Fallback
MediaEl->>MediaEl: Attempt load from arweave.net
MediaEl-->>Handler: onError event fired
Handler->>Utils: isArweaveUrl(currentSrc)?
Utils-->>Handler: true
Handler->>Utils: getArweaveFallbackUrl(currentSrc)
Utils-->>Handler: ar-io.net URL
Handler->>MediaEl: set currentSrc = ar-io.net URL
MediaEl->>FallbackHost: Retry load from ar-io.net
FallbackHost-->>MediaEl: Asset loads (or triggers onError again)
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/nft-image/utils/arweave-fallback.ts`:
- Around line 31-41: The error handler returned by the arweave fallback utility
currently replaces target.src immediately which loses the original failing URL;
modify the handler (the returned function that accepts MediaErrorEvent used with
isArweaveUrl and getArweaveFallbackUrl) to first store the original src into a
data attribute (e.g., target.dataset.arweaveOriginalSrc) only if not already
present, then set target.src to the fallback and return; leave onError?.(event)
unchanged for non-arweave or no-fallback cases; downstream handlers can then
read and clear dataset.arweaveOriginalSrc to compare against the true original
failing source.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
components/nft-image/renderers/NFTImageRenderer.tsxcomponents/nft-image/renderers/NFTVideoRenderer.tsxcomponents/nft-image/utils/arweave-fallback.tsconfig/nextConfig.ts
|



Summary by CodeRabbit