Skip to content

Conversation

@iuwqyir
Copy link
Contributor

@iuwqyir iuwqyir commented May 20, 2025

[Playground] Fix: Update chain parameter handling in blueprint playground

Notes for the reviewer

This PR updates the blueprint playground to use chain_id instead of chain parameter throughout the codebase. It also adds logic to remove deprecated parameters from the form schema and specifically removes the chain parameter if it's present.

How to test

Test the blueprint playground with various chain selections to ensure the chain_id parameter is correctly populated and that deprecated parameters are not displayed in the form.

Summary by CodeRabbit

  • Refactor

    • Updated all references from "chain" to "chain_id" for improved consistency across the playground interface.
    • Deprecated parameters are now excluded from form generation and display.
  • New Features

    • Blueprint listings can now indicate if a blueprint is deprecated.
  • Chores

    • Made the API domain configurable via environment variables with a default fallback.

PR-Codex overview

This PR primarily focuses on updating the BlueprintSection and related functionality to handle a new optional deprecated property for blueprints, along with renaming parameters for consistency and improving the handling of API domain configuration.

Detailed summary

  • Updated BlueprintSection to include an optional deprecated property in blueprints.
  • Introduced THIRDWEB_INSIGHT_API_DOMAIN for API domain configuration.
  • Changed API URL construction to use the new constant.
  • Renamed chain parameter to chain_id in multiple locations for consistency.
  • Removed chain parameter from parameters if present.
  • Updated form handling to reflect the new chain_id parameter.
  • Added logic to skip deprecated parameters in form schema creation.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented May 20, 2025

⚠️ No Changeset found

Latest commit: 438c019

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2025 8:49pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 20, 2025 8:49pm
login ⬜️ Skipped (Inspect) May 20, 2025 8:49pm
thirdweb-www ⬜️ Skipped (Inspect) May 20, 2025 8:49pm
wallet-ui ⬜️ Skipped (Inspect) May 20, 2025 8:49pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 20, 2025

Walkthrough

The changes update the usage of the parameter "chain" to "chain_id" throughout the playground blueprint UI logic, ensuring consistent naming and handling. Deprecated parameters are now excluded from form schema generation. Additionally, the type definition for blueprints in the BlueprintSection component is extended to optionally include a deprecated property. The API domain for fetching blueprint specs is made configurable via an environment variable.

Changes

File(s) Change Summary
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx Renamed all references from "chain" to "chain_id"; removed "chain" if present; made "chain_id" required; excluded deprecated parameters from form schema.
apps/playground-web/src/app/insight/page.tsx Extended the type for BlueprintSection's blueprints prop to optionally include a deprecated boolean.
apps/playground-web/src/app/insight/utils.ts Added THIRDWEB_INSIGHT_API_DOMAIN constant for configurable API domain; updated fetchBlueprintSpec to use this constant instead of hardcoded domain.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BlueprintPlaygroundUI
    participant modifyParametersForPlayground
    participant Form

    User->>BlueprintPlaygroundUI: Interacts with playground UI
    BlueprintPlaygroundUI->>modifyParametersForPlayground: Prepare parameters
    modifyParametersForPlayground->>modifyParametersForPlayground: Remove "chain", require "chain_id", skip deprecated
    modifyParametersForPlayground-->>BlueprintPlaygroundUI: Return modified parameters
    BlueprintPlaygroundUI->>Form: Render form with "chain_id" and non-deprecated parameters
    Form->>BlueprintPlaygroundUI: Submit form values
Loading

📜 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 bde14b9 and 438c019.

📒 Files selected for processing (3)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (6 hunks)
  • apps/playground-web/src/app/insight/page.tsx (1 hunks)
  • apps/playground-web/src/app/insight/utils.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/playground-web/src/app/insight/page.tsx
  • apps/playground-web/src/app/insight/utils.ts
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@github-actions github-actions bot added the Playground Changes involving the Playground codebase. label May 20, 2025
Copy link
Contributor Author

iuwqyir commented May 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@iuwqyir iuwqyir requested review from MananTank and jnsdls May 20, 2025 19:45
@iuwqyir iuwqyir marked this pull request as ready for review May 20, 2025 19:45
@iuwqyir iuwqyir requested review from a team as code owners May 20, 2025 19:45
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.81%. Comparing base (6104401) to head (438c019).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7099   +/-   ##
=======================================
  Coverage   55.81%   55.81%           
=======================================
  Files         900      900           
  Lines       57848    57848           
  Branches     4067     4067           
=======================================
  Hits        32288    32288           
  Misses      25454    25454           
  Partials      106      106           
Flag Coverage Δ
packages 55.81% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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: 0

🧹 Nitpick comments (1)
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (1)

501-506: Remove debugging log statement.

The console.log statement should be removed as it appears to be added for debugging purposes and isn't necessary for production code.

- console.log("chainIds", chainIds);
  props.form.setValue("chain_id", chainIds, {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6104401 and 483ce36.

📒 Files selected for processing (2)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (6 hunks)
  • apps/playground-web/src/app/insight/page.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (1)
apps/playground-web/src/components/blocks/NetworkSelectors.tsx (1)
  • MultiNetworkSelector (15-129)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
apps/playground-web/src/app/insight/page.tsx (1)

44-44: Good addition of deprecated flag support.

The type definition now includes an optional deprecated boolean property, which aligns with the changes in the blueprint playground client that filter out deprecated parameters.

apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (7)

112-115: Parameter name update from chain to chain_id.

The code now correctly identifies the chain parameter using chain_id instead of chain. This is consistent with the PR objective to replace all instances of chain with chain_id.


125-129: Good handling of deprecated parameter removal.

This addition explicitly removes the chain parameter if present, which ensures a clean transition to using chain_id instead. This helps prevent duplicate or conflicting parameters in the API calls.


172-174: Updated default value assignment to use chain_id.

The default value assignment has been updated to use chain_id instead of chain, maintaining consistency with the parameter rename throughout the codebase.


475-478: Consistent UI rendering condition update.

The grid layout condition has been updated to check for chain_id instead of chain, ensuring the UI renders correctly with the updated parameter name.


494-515: Updated MultiNetworkSelector handling.

The selector component now properly uses chain_id for its conditional rendering and data binding, which is consistent with the parameter rename throughout the application.


498-499: Type casting for chain_id watch looks good.

The form watch method now correctly references chain_id instead of chain.


831-833: Good implementation of deprecated parameter skipping.

This new code skips parameters marked as deprecated when creating the form schema. This is an important enhancement that prevents deprecated parameters from appearing in the UI, as specified in the PR objectives.

@github-actions
Copy link
Contributor

github-actions bot commented May 20, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 56.57 KB (0%) 1.2 s (0%) 297 ms (+94.85% 🔺) 1.5 s
thirdweb (cjs) 309.52 KB (0%) 6.2 s (0%) 1.5 s (+0.89% 🔺) 7.7 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 57 ms (+194.34% 🔺) 171 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 26 ms (+355% 🔺) 37 ms
thirdweb/react (minimal + tree-shaking) 19.5 KB (0%) 390 ms (0%) 90 ms (+217.78% 🔺) 480 ms

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: 0

🧹 Nitpick comments (2)
apps/playground-web/src/app/insight/utils.ts (1)

9-10: Inconsistency with existing constants in codebase.

This new constant THIRDWEB_INSIGHT_API_DOMAIN uses a different environment variable name (NEXT_PUBLIC_INSIGHT_URL) and default value ("insight.thirdweb.com") compared to a similar constant in apps/dashboard/src/constants/urls.ts which uses NEXT_PUBLIC_INSIGHT_API_URL and defaults to "insight.thirdweb-dev.com".

Consider aligning the naming and defaults with existing patterns in the codebase, or documenting why they differ.

apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (1)

905-906: Remove ESLint directive unless necessary.

The code contains an ESLint directive (// eslint-disable-next-line no-restricted-syntax) that may not be needed anymore depending on your ESLint configuration.

Consider removing this comment if the ESLint rule is no longer applicable or documenting why the exception is necessary.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7e98519 and bde14b9.

📒 Files selected for processing (3)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (6 hunks)
  • apps/playground-web/src/app/insight/page.tsx (1 hunks)
  • apps/playground-web/src/app/insight/utils.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/playground-web/src/app/insight/page.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/playground-web/src/app/insight/utils.ts (1)
apps/dashboard/src/constants/urls.ts (1)
  • THIRDWEB_INSIGHT_API_DOMAIN (24-25)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
apps/playground-web/src/app/insight/utils.ts (1)

46-46: LGTM: Using configurable domain for API endpoint.

The change to use the configurable THIRDWEB_INSIGHT_API_DOMAIN constant improves flexibility by allowing the API domain to be configured via environment variables.

apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (7)

112-115: LGTM: Parameter name updated from "chain" to "chain_id".

This change correctly updates the parameter name from "chain" to "chain_id", which is consistent with the PR objective.


125-129: LGTM: Added code to remove deprecated "chain" parameter.

This new code block correctly removes the deprecated "chain" parameter from the parameters list, which is consistent with the PR objective to replace "chain" with "chain_id".


172-173: LGTM: Default value handling updated for "chain_id" parameter.

Updated the default value handling to use "chain_id" instead of "chain", maintaining consistency with the parameter renaming.


475-478: LGTM: Updated conditional rendering for "chain_id" parameter.

This change correctly updates the conditional check from "chain" to "chain_id", ensuring the proper grid layout is applied.


494-499: LGTM: Updated MultiNetworkSelector to use "chain_id" parameter.

This change correctly updates the MultiNetworkSelector to use the renamed "chain_id" parameter for tracking selected chain IDs.


500-505: LGTM: Updated form value setter to use "chain_id" parameter.

This change correctly updates the form setValue call to use "chain_id" instead of "chain", completing the parameter renaming.


830-832: LGTM: Skip deprecated parameters when creating the form schema.

This new code properly implements the logic to skip deprecated parameters when generating the form schema, which supports the PR objective of handling deprecated parameters like "chain".

@iuwqyir iuwqyir added the merge-queue Adds the pull request to Graphite's merge queue. label May 20, 2025
Copy link
Contributor Author

iuwqyir commented May 20, 2025

Merge activity

## [Playground] Fix: Update chain parameter handling in blueprint playground

## Notes for the reviewer
This PR updates the blueprint playground to use `chain_id` instead of `chain` parameter throughout the codebase. It also adds logic to remove deprecated parameters from the form schema and specifically removes the `chain` parameter if it's present.

## How to test
Test the blueprint playground with various chain selections to ensure the chain_id parameter is correctly populated and that deprecated parameters are not displayed in the form.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
  - Updated all references from "chain" to "chain_id" for improved consistency across the playground interface.
  - Deprecated parameters are now excluded from form generation and display.

- **New Features**
  - Blueprint listings can now indicate if a blueprint is deprecated.

- **Chores**
  - Made the API domain configurable via environment variables with a default fallback.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces changes to the `BlueprintSection`, `fetchBlueprintSpec`, and other components to enhance the handling of blueprint parameters, including the addition of a `deprecated` flag and renaming of parameters for consistency. It also updates the API URL handling.

### Detailed summary
- Added optional `deprecated` property to `blueprints` in `BlueprintSection`.
- Introduced `THIRDWEB_INSIGHT_API_DOMAIN` for dynamic API URL in `fetchBlueprintSpec`.
- Renamed parameter `chain` to `chain_id` in multiple places for consistency.
- Removed `chain` parameter if present in `modifyParametersForPlayground`.
- Updated form handling to use `chain_id` instead of `chain` in `ParameterSection`.
- Skipped deprecated parameters in schema creation with `createParametersFormSchema`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
@graphite-app graphite-app bot force-pushed the 05-20-replace_chain_with_chain_id_in_insight_playground branch from bde14b9 to 438c019 Compare May 20, 2025 20:46
@graphite-app graphite-app bot merged commit 438c019 into main May 20, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 05-20-replace_chain_with_chain_id_in_insight_playground branch May 20, 2025 20:56
@graphite-app graphite-app bot removed the merge-queue Adds the pull request to Graphite's merge queue. label May 20, 2025
@vercel vercel bot temporarily deployed to Production – login May 20, 2025 20:56 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb-www May 20, 2025 20:56 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui May 20, 2025 20:56 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 May 20, 2025 20:56 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Playground Changes involving the Playground codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants