Skip to content

Arweave Fallback - More gateways#2029

Merged
prxt6529 merged 3 commits intomainfrom
arweave-fallback-4
Mar 2, 2026
Merged

Arweave Fallback - More gateways#2029
prxt6529 merged 3 commits intomainfrom
arweave-fallback-4

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Mar 2, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved robustness of Arweave image loading by implementing a prioritized gateway fallback system that automatically attempts alternative gateways when one fails.
    • Enhanced error handling to ensure graceful degradation when image sources cannot be resolved.

Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Warning

Rate limit exceeded

@prxt6529 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d88af82 and 8abda0c.

📒 Files selected for processing (1)
  • components/nft-image/utils/arweave-fallback.ts
📝 Walkthrough

Walkthrough

Refactors Arweave URL fallback handling by introducing a prioritized gateway list and utility functions to validate and reconstruct URLs. Reworks the withArweaveFallback logic to sequentially attempt gateway URLs on failures while tracking state via data attributes.

Changes

Cohort / File(s) Summary
Arweave Fallback Utilities
components/nft-image/utils/arweave-fallback.ts
Introduces ARWEAVE_GATEWAYS constant and utility functions (safeParseUrl, normalizeHost, isArweaveGatewayHost, getGatewayIndexFromUrl, buildUrlWithGateway) for gateway URL handling. Refactors withArweaveFallback to validate Arweave URLs, track current gateway index via data attributes, and cycle through prioritized gateways on load failures.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • ragnep
  • simo6529

Poem

🐰 Arweave gateways, one by one,
A rabbit hops till work is done.
From net to gate, we try and try,
Till images load up to the sky! 📸

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Arweave Fallback - More gateways' directly and clearly summarizes the main change: expanding Arweave gateway support with a prioritized list of gateways.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch arweave-fallback-4

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 84-97: The element dataset values DS_ORIGINAL and DS_INDEX persist
across reuses causing fallback to continue from a previous asset; modify the
logic around originalSrc/currentSrc (and uses of target.dataset[DS_ORIGINAL],
target.dataset[DS_INDEX], and getGatewayIndexFromUrl) to detect when the
element's src has changed: if target.dataset[DS_ORIGINAL] exists but differs
from currentSrc, reset/clear DS_INDEX and set DS_ORIGINAL to currentSrc so
storedIdx is recomputed for the new asset; ensure currentIdx is then derived
from the fresh storedIdx or getGatewayIndexFromUrl(currentSrc).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abd156e and d88af82.

📒 Files selected for processing (1)
  • components/nft-image/utils/arweave-fallback.ts

Comment thread components/nft-image/utils/arweave-fallback.ts
Signed-off-by: prxt6529 <prxt@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 2, 2026

@prxt6529 prxt6529 merged commit c6fba7f into main Mar 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants