Skip to content

Conversation

@dtfiedler
Copy link
Contributor

@dtfiedler dtfiedler commented Jul 15, 2025

No longer rely on static gateway list, and fetch them from wayfinder using the RandomRoutingStrategy

After:
image

Summary by CodeRabbit

  • New Features

    • Integrated Wayfinder framework for enhanced gateway management, routing, and telemetry.
  • Refactor

    • Simplified domain card and featured domains components by removing gateway selection and shuffling logic.
    • Updated network configuration defaults with legacy mode support.
    • Added legacy mode configuration to network connection settings in devtools and settings pages.
  • Chores

    • Updated and added dependencies for Wayfinder packages and adjusted existing package versions.

No longer rely on static gateway list, and fetch them from wayfinder using the RandomRoutingStrategy
@dtfiedler dtfiedler requested a review from a team as a code owner July 15, 2025 16:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Walkthrough

The updates integrate the Wayfinder framework into the application by adding related dependencies, refactoring ARNSCard and FeaturedDomains components to utilize Wayfinder for asynchronous URL resolution and gateway management, and updating global state context to wrap children in a Wayfinder provider. Network configuration constants and connection calls are extended with a new legacy mode property.

Changes

File(s) Change Summary
package.json Added @ar.io/wayfinder-core and @ar.io/wayfinder-react dependencies; updated @permaweb/aoconnect version; removed resolutions field.
src/components/cards/ARNSCard/ARNSCard.tsx Refactored to use useWayfinderUrl hook for async URL resolution; removed gateway prop and related logic; updated link and alt text formatting; added error logging.
src/components/layout/FeaturedDomains/FeaturedDomains.tsx Removed gateway state, shuffling logic, and shuffle button; simplified domain display count management; removed gateway prop from ARNSCard usage; updated key usage and styling.
src/state/contexts/GlobalState.tsx Wrapped children inside WayfinderProvider with nested gateways providers, routing strategy, and telemetry configuration.
src/utils/constants.ts Replaced arioDevnetProcessId with ARIO_TESTNET_PROCESS_ID; added MODE: 'legacy' property to ARIO and ANT network configs; removed commented-out featured domains; added TODO comment.
src/components/devtools/NetworkSettings.tsx Added MODE: 'legacy' property to connect calls for ARIO and ANT AO network clients.
src/components/pages/Settings/NetworkSettings.tsx Added MODE: 'legacy' property to connect call inside updateAoNetwork function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FeaturedDomains
    participant ARNSCard
    participant Wayfinder (Provider/Hook)
    participant GlobalStateProvider

    User->>FeaturedDomains: View featured domains
    FeaturedDomains->>ARNSCard: Render ARNSCard(domain)
    ARNSCard->>Wayfinder: useWayfinderUrl().resolveUrl(domain)
    Wayfinder-->>ARNSCard: Return resolved URL or error
    ARNSCard->>User: Display domain card with resolved link or fallback
Loading

Poem

In the garden of code, Wayfinder hops in,
With legacy modes and gateways to spin.
ARNSCards now wander, resolving with flair,
While featured domains are lighter to share.
The state wraps in context, so seamless and neat—
A bunny’s delight, this refactored feat!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72256a9 and edeb28a.

📒 Files selected for processing (1)
  • src/components/cards/ARNSCard/ARNSCard.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/cards/ARNSCard/ARNSCard.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_and_test / lint_test_build
  • GitHub Check: lint_test_build
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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

🧹 Nitpick comments (1)
src/components/cards/ARNSCard/ARNSCard.tsx (1)

30-41: Simplify redundant conditional rendering

The conditional rendering checks wayfinderUrl twice unnecessarily. Since line 21 already returns a <Loader /> when wayfinderUrl is null, this condition is redundant.

-      {wayfinderUrl ? (
-        <img
-          className="arns-preview fade-in"
-          src={imageUrl}
-          key={imageUrl}
-          alt={`${domain}`}
-          width={'100%'}
-          height={'100%'}
-        />
-      ) : (
-        <Loader size={40} />
-      )}
+      <img
+        className="arns-preview fade-in"
+        src={imageUrl}
+        key={imageUrl}
+        alt={`${domain}`}
+        width={'100%'}
+        height={'100%'}
+      />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33c4233 and ae8ea73.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • package.json (1 hunks)
  • src/components/cards/ARNSCard/ARNSCard.tsx (2 hunks)
  • src/components/layout/FeaturedDomains/FeaturedDomains.tsx (1 hunks)
  • src/state/contexts/GlobalState.tsx (4 hunks)
  • src/utils/constants.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/components/cards/ARNSCard/ARNSCard.tsx (2)
src/types.ts (1)
  • ARNSMapping (38-57)
src/components/layout/index.ts (1)
  • Loader (12-12)
src/state/contexts/GlobalState.tsx (1)
src/utils/constants.ts (1)
  • APP_VERSION (23-23)
src/components/layout/FeaturedDomains/FeaturedDomains.tsx (2)
src/utils/constants.ts (1)
  • FEATURED_DOMAINS (173-184)
src/components/cards/index.ts (1)
  • ARNSCard (4-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_and_test / lint_test_build
  • GitHub Check: lint_test_build
🔇 Additional comments (10)
src/utils/constants.ts (2)

134-134: LGTM: MODE configuration supports Wayfinder integration

The addition of MODE: 'legacy' to both ARIO and ANT network configurations is consistent with the usage in src/state/contexts/GlobalState.tsx where this parameter is passed to the connect call.

Also applies to: 142-142


174-174: Good planning: TODO comment for dynamic featured domains

The TODO comment indicates future plans to pull featured domains from the ARIO contract, which aligns with the PR objective of moving away from static data sources.

package.json (2)

29-30: Alpha dependencies in production – proceed with caution

Both @ar.io/[email protected] and @ar.io/[email protected] are experimental alpha releases with no stable versions available (see GitHub[1] and docs[2]). Using them in production may introduce breaking changes and unexpected bugs. Please:

  • Confirm these alpha packages meet your stability requirements or delay production deployment until stable releases are published.
  • Pin the exact alpha versions (remove the ^ prefix) to avoid inadvertent upgrades.
  • Ensure comprehensive testing around Wayfinder-powered features.
  • Verify that updating @permaweb/aoconnect to 0.0.69 remains compatible with your integration.

Citations:
1: https://github.com/ar-io/wayfinder
2: https://docs.ar.io/wayfinder/react


32-32: Verify @permaweb/aoconnect v0.0.69 compatibility

I’ve searched all .ts/.tsx files and confirmed that connect from @permaweb/aoconnect is imported in many places, for example:

  • src/state/contexts/GlobalState.tsx
  • src/state/actions/dispatchArNSUpdate.ts
  • src/state/contexts/ArNSState.tsx
  • src/services/turbo/TurboArNSClient.ts
  • src/hooks/useTurboArNSClient.tsx
  • src/components/pages/Settings/NetworkSettings.tsx
  • …and several more

Given the widespread use of this package, please:

• Review the package’s CHANGELOG or release notes for v0.0.69 to spot any breaking changes.
• Run the relevant unit/integration tests (or smoke tests) that exercise connect to ensure nothing has regressed.

src/components/layout/FeaturedDomains/FeaturedDomains.tsx (2)

36-49: LGTM: Simplified component aligns with Wayfinder integration

The removal of gateway-related logic and props correctly implements the centralized gateway management approach via Wayfinder. The ARNSCard components now handle URL resolution internally using the useWayfinder hook.


51-51: Minor styling improvement

The styling adjustment on the button container improves the layout consistency.

src/components/cards/ARNSCard/ARNSCard.tsx (1)

54-54: LGTM: Appropriate display format for ArNS domains

The ar:// prefix correctly represents the ArNS domain format and provides better user understanding of the domain structure.

src/state/contexts/GlobalState.tsx (3)

8-15: LGTM: Comprehensive Wayfinder imports

The imports include all necessary Wayfinder components for gateway management, routing strategy, and React integration.


45-45: Consistent MODE configuration

The MODE: 'legacy' parameter is consistent with the network defaults defined in src/utils/constants.ts.


129-148: Excellent Wayfinder provider configuration

The WayfinderProvider is well-configured with:

  • Layered gateway providers (LocalStorage + Network)
  • RandomRoutingStrategy for load balancing
  • Telemetry enabled with proper client identification

This implementation correctly centralizes gateway management and provides the foundation for dynamic URL resolution throughout the app.

@github-actions
Copy link

github-actions bot commented Jul 15, 2025

Visit the preview URL for this PR (updated for commit edeb28a):

https://arns-portal--pr801-pe-8019-wayfinder-ro-b2mykd9b.web.app

(expires Fri, 01 Aug 2025 16:30:33 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1f59769442cb89cf2a92042a342e51fe94047b94

Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5037ff and 9eeba98.

📒 Files selected for processing (1)
  • src/components/cards/ARNSCard/ARNSCard.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/cards/ARNSCard/ARNSCard.tsx (2)
src/types.ts (1)
  • ARNSMapping (38-57)
src/components/layout/index.ts (1)
  • Loader (12-12)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_and_test / lint_test_build
  • GitHub Check: lint_test_build
🔇 Additional comments (5)
src/components/cards/ARNSCard/ARNSCard.tsx (5)

1-2: LGTM! Clean import structure for Wayfinder integration.

The imports correctly bring in the useWayfinderUrl hook for dynamic URL resolution and the Loader component for loading states.


11-18: Well-structured Wayfinder integration with appropriate fallback.

The component signature correctly removes the gateway dependency, and the useWayfinderUrl hook is properly configured with the domain name and a sensible fallback URL.


20-22: Error handling looks good as previously addressed.

The error logging implementation is appropriate and aligns with the previous review feedback that was addressed.


27-27: Good use of optional chaining with fallback URL.

The link destination properly handles the resolved URL with optional chaining and provides a sensible fallback.


55-55: Appropriate display format for Arweave domains.

The change to ar://${domain} format correctly reflects the Wayfinder integration and removes the gateway dependency.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 15, 2025
This is not needed and will just rerender the div when the new url is available
It seems to constantly rerender, even with useMemo in the useWayfinderUrl hook
@dtfiedler dtfiedler merged commit 2975905 into develop Jul 18, 2025
7 checks passed
@dtfiedler dtfiedler deleted the PE-8019-wayfinder-routing branch July 18, 2025 17:10
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.

4 participants