Skip to content

[Portal] fix portal build #7154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2025
Merged

[Portal] fix portal build #7154

merged 1 commit into from
May 24, 2025

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented May 24, 2025

Summary by CodeRabbit

  • New Features

    • Enabled static parameter generation for TypeScript reference pages, improving navigation and loading performance.
  • Improvements

    • Increased the tolerance for duplicate slugs, reducing the likelihood of errors when creating new reference entries.
    • Enhanced slug generation and extension name extraction for more accurate and reliable content linking.

PR-Codex overview

This PR primarily focuses on updating the limit value in uniqueSlugger.ts, enhancing slug generation logic in getSidebarLinkgroups.ts, and refining various documentation references across multiple files, including the addition of new hooks and restructuring existing ones.

Detailed summary

  • Increased limit from 10 to 20 in uniqueSlugger.ts.
  • Enhanced slug generation logic in getSidebarLinkgroups.ts for better handling of extension names.
  • Refined metadata generation in page.tsx.
  • Updated references in llms.txt for better clarity and organization.
  • Added new sections for MARKETPLACE and AIRDROP with detailed methods in llms.txt.
  • Restructured existing references to include prefixes for better categorization.
  • Improved type handling in Summary.tsx for slug generation.

The following files were skipped due to too many changes: apps/portal/public/llms.txt, apps/portal/public/llms-full.txt

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

@joaquim-verges joaquim-verges requested review from a team as code owners May 24, 2025 05:25
Copy link

changeset-bot bot commented May 24, 2025

⚠️ No Changeset found

Latest commit: 5c22ce8

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

Copy link

vercel bot commented May 24, 2025

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

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

Copy link
Contributor

graphite-app bot commented May 24, 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.

Copy link

coderabbitai bot commented May 24, 2025

Walkthrough

The changes increase the slug uniqueness attempt limit, enable static parameter generation by exporting generateStaticParams, adjust slug generation from heading children in TypedocSummary, and refine extension name extraction logic with deeper property checks and altered fallback behavior.

Changes

File(s) Change Summary
apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts Increased max attempts for unique slug suffix from 10 to 20.
apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx Enabled static parameter generation by exporting generateStaticParams directly instead of commenting it out.
apps/portal/src/app/references/components/TDoc/Summary.tsx Changed slug source from s.children[0]?.data?.hName to (s.children[0] as any).value with lint suppression.
apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts Modified getExtensionName to use nested children[0].value with fallback to undefined instead of "Common".

Sequence Diagram(s)

Error: Could not generate a valid Mermaid diagram after multiple attempts.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

📜 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 435f1a2 and 5c22ce8.

📒 Files selected for processing (4)
  • apps/portal/src/app/references/components/TDoc/Summary.tsx (1 hunks)
  • apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts (1 hunks)
  • apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts (1 hunks)
  • apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts
  • apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx
  • apps/portal/src/app/references/components/TDoc/Summary.tsx
  • apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • 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 Portal Involves changes to the Portal (docs) codebase. label May 24, 2025
Copy link

codecov bot commented May 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.68%. Comparing base (ad4341a) to head (5c22ce8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7154   +/-   ##
=======================================
  Coverage   55.68%   55.68%           
=======================================
  Files         904      904           
  Lines       58340    58340           
  Branches     4107     4107           
=======================================
  Hits        32484    32484           
  Misses      25751    25751           
  Partials      105      105           
Flag Coverage Δ
packages 55.68% <ø> (ø)
🚀 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

@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/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts (1)

5-5: LGTM - Fix addresses build issue, but consider investigating root cause.

Increasing the limit from 10 to 20 helps handle more duplicate slugs during the portal build process. The change is straightforward and effective for resolving the immediate build failure.

However, consider investigating why so many duplicate slugs are being generated, as this might indicate an underlying issue with the documentation structure or slug generation logic.

You might also consider making the limit configurable rather than hardcoded:

-export function uniqueSlugger(options: {
+export function uniqueSlugger(options: {
   base: string;
   isUnique: (slug: string) => boolean;
+  limit?: number;
 }) {
-  const limit = 20;
+  const limit = options.limit ?? 20;
   const { base, isUnique } = options;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ad4341a and c39d7e7.

📒 Files selected for processing (2)
  • apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts (1 hunks)
  • apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx (1)

15-15:

❓ Verification inconclusive

LGTM - Enabling static generation improves performance.

Re-enabling generateStaticParams is a good change that will improve build-time static generation and overall performance. The coordination with the uniqueSlugger limit increase should resolve the duplicate slug issues that previously prevented this from working.

Please verify that the portal build completes successfully with these changes:


🏁 Script executed:

#!/bin/bash
# Description: Verify that the portal build works with static generation enabled

echo "Checking if the portal app builds successfully..."
cd apps/portal

# Check if build script exists and run it
if [ -f "package.json" ]; then
    if npm run build --dry-run 2>/dev/null; then
        echo "Build script found - you should run 'npm run build' to verify the build works"
    else
        echo "Build script not found or different command needed"
    fi
else
    echo "No package.json found in portal directory"
fi

# Check for any build-related scripts
echo "Available scripts in portal:"
if [ -f "package.json" ]; then
    cat package.json | jq '.scripts // {}'
fi

Length of output: 1427


Approve static generation; verify build with pnpm

Re-enabling generateStaticParams is a safe, performance-boosting change now that duplicate slugs are handled by the updated uniqueSlugger. Before merging, please confirm that the portal app still builds correctly.

• Location to verify: apps/portal
• Steps:

  1. Install dependencies: pnpm install
  2. Run build: pnpm run build

Copy link
Contributor

github-actions bot commented May 24, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 61.75 KB (0%) 1.3 s (0%) 213 ms (+159.14% 🔺) 1.5 s
thirdweb (cjs) 344.4 KB (0%) 6.9 s (0%) 631 ms (+8.12% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 62 ms (+1299.55% 🔺) 176 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 20 ms (+1487.85% 🔺) 30 ms
thirdweb/react (minimal + tree-shaking) 19.54 KB (0%) 391 ms (0%) 110 ms (+682% 🔺) 501 ms

@joaquim-verges joaquim-verges force-pushed the 05-23-fix_portal_build branch from c39d7e7 to 435f1a2 Compare May 24, 2025 05:43
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 24, 2025 05:43 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 24, 2025 05:43 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www May 24, 2025 05:43 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 24, 2025 05:43 Inactive
Copy link
Member Author


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.

@joaquim-verges joaquim-verges force-pushed the 05-23-fix_portal_build branch from 435f1a2 to 5c22ce8 Compare May 24, 2025 05:46
@vercel vercel bot temporarily deployed to Preview – thirdweb-www May 24, 2025 05:46 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 24, 2025 05:46 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 24, 2025 05:46 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 24, 2025 05:46 Inactive
Copy link

@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/portal/src/app/references/components/TDoc/Summary.tsx (1)

88-89: Consider improving type safety instead of using any cast.

While the lint suppression acknowledges the complexity, casting to any weakens type safety. The change appears to fix a real data structure issue, but consider defining a proper type interface for the expected structure.

Consider creating a type guard or interface instead of using any:

-                // biome-ignore lint/suspicious/noExplicitAny: complex type
-                id={slugger.slug((s.children[0] as any)?.value ?? "", false)}
+                id={slugger.slug(getChildValue(s.children[0]) ?? "", false)}

And define a helper function:

function getChildValue(child: unknown): string | undefined {
  if (child && typeof child === 'object' && 'value' in child) {
    const value = (child as { value: unknown }).value;
    return typeof value === 'string' ? value : undefined;
  }
  return undefined;
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c39d7e7 and 435f1a2.

📒 Files selected for processing (4)
  • apps/portal/src/app/references/components/TDoc/Summary.tsx (1 hunks)
  • apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts (1 hunks)
  • apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts (1 hunks)
  • apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/portal/src/app/references/components/TDoc/utils/uniqueSlugger.ts
  • apps/portal/src/app/references/typescript/[version]/[[...slug]]/page.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/portal/src/app/references/components/TDoc/utils/getSidebarLinkgroups.ts (1)

413-423:

✅ Verification successful

Verify the impact of changing fallback behavior from "Common" to undefined.

The change to access the value property is consistent with the similar fix in Summary.tsx, which suggests this addresses a real data structure change. However, changing the fallback from "Common" to undefined could have broader implications.

Please verify that changing the fallback behavior doesn't break existing functionality, especially for extensions that previously defaulted to "Common". Run this script to check how this function is used:


🏁 Script executed:

#!/bin/bash
# Description: Check usage of getExtensionName and how undefined return values are handled

# Search for getExtensionName usage
rg -A 5 -B 2 "getExtensionName"

# Look for any code that expects "Common" as a default
rg -A 3 -B 3 '"Common"'

Length of output: 15976


getExtensionName fallback behavior remains unchanged

Verification shows that all call sites either provide their own "Common" default or treat undefined and "Common" identically, preserving existing behavior:

  • apps/portal/src/app/typescript/v5/sidebar.tsx
    Uses getExtensionName(blockTag) || "Common", so missing values still default to "Common".
  • apps/portal/src/app/references/components/TDoc/Function.tsx
    Renders extensionName && extensionName !== "Common" ? … : doc.name, so undefined and "Common" both result in doc.name.
  • apps/portal/src/app/references/components/TDoc/utils/slugs.ts
    Only truthy extensionName values generate slugs; skipping undefined matches prior behavior.

No further action required.

@joaquim-verges joaquim-verges merged commit 5139857 into main May 24, 2025
24 of 25 checks passed
@joaquim-verges joaquim-verges deleted the 05-23-fix_portal_build branch May 24, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Portal Involves changes to the Portal (docs) codebase.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant