Skip to content

Make React icons RSC friendly#4

Merged
nathangathright merged 1 commit into
mainfrom
codex/react-icons-rsc
May 18, 2026
Merged

Make React icons RSC friendly#4
nathangathright merged 1 commit into
mainfrom
codex/react-icons-rsc

Conversation

@nathangathright
Copy link
Copy Markdown
Contributor

@nathangathright nathangathright commented May 18, 2026

Summary

  • make @podlink/icons/react prop-only by removing PodlinkProvider / usePodlinkConfig
  • remove client-only React boundary markers from the package components and entrypoint
  • document Next.js App Router usage for Server Components and app-local wrappers

Why

The primary consumer is the Podlink Next.js App Router app. The previous React entrypoint pulled context APIs into the public barrel, which made the package easy to import through a server path and could produce confusing production build failures. The icon and badge components do not need package-level context, so this keeps the React API smaller and RSC-friendly.

Validation

  • pnpm build
  • pnpm test
  • confirmed dist/react/index.js and dist/react/index.cjs contain no use client, createContext, or useContext
  • packed the package into /Users/nathan/Developer/podlink-v3 and ran:
    • pnpm exec tsc --noEmit
    • pnpm exec next build with dummy values for required env vars

Summary by CodeRabbit

  • Documentation: Enhanced Next.js App Router support documentation with Server Component usage examples and wrapper recommendations.
  • Refactor: Removed the context-based configuration system. Component configuration now relies on direct props instead of inherited context values, streamlining the API. Improved Server Component compatibility by removing client-only directives.

Review Change Stack

@nathangathright
Copy link
Copy Markdown
Contributor Author

@vercel review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 161760f9-e910-477a-8c9f-6946ddb5cb8f

📥 Commits

Reviewing files that changed from the base of the PR and between 0a3d228 and 2caf0a5.

📒 Files selected for processing (6)
  • README.md
  • src/react/PlatformBadge.tsx
  • src/react/PlatformIcon.tsx
  • src/react/PodlinkProvider.tsx
  • src/react/components.test.tsx
  • src/react/index.ts
💤 Files with no reviewable changes (2)
  • src/react/index.ts
  • src/react/PodlinkProvider.tsx

📝 Walkthrough

Walkthrough

This PR removes the PodlinkProvider context pattern entirely, making React components server-compatible by eliminating usePodlinkConfig dependencies and 'use client' directives. Components now resolve configuration exclusively from props with hardcoded defaults. Exports, tests, and documentation are updated accordingly to reflect the simpler prop-only API.

Changes

Provider Removal and Component Refactoring

Layer / File(s) Summary
Component refactoring and use client removal
src/react/PlatformBadge.tsx, src/react/PlatformIcon.tsx
Both components drop 'use client' directives and remove usePodlinkConfig imports. Theme, label, dir, and shape are now resolved solely from props with fixed defaults (light, Listen on, ltr, superellipse) instead of context-aware fallback chains.
Export surface cleanup
src/react/index.ts
PodlinkProvider, usePodlinkConfig, PodlinkProviderProps, and PodlinkConfig re-exports are removed. Only PlatformIcon and PlatformBadge with their prop types remain exposed.

Test and Documentation Updates

Layer / File(s) Summary
Test coverage for components without provider
src/react/components.test.tsx
PodlinkProvider test suite and import are removed. A new PlatformBadge test validates the default light theme behavior via background color assertion.
README App Router guidance and provider removal
README.md
Removes PodlinkProvider and usePodlinkConfig documentation from the React API section. Adds Next.js App Router subsection under Quick start explaining Server Component compatibility and providing example wrapper component code.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

  • #3: The removal of 'use client' directives, elimination of the PodlinkProvider context pattern, and addition of Next.js App Router guidance directly address the client-boundary and server-component compatibility issue described in this issue.

Poem

🐰 The Provider's gone, no more context to weave,
Components now stand alone, props up their sleeve,
'Use client' removed for servers so keen,
Defaults hardcoded where context had been,
App Router awaits, the path now is clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing React context APIs and 'use client' directives to make the package React Server Component friendly.
Description check ✅ Passed The PR description provides a clear summary, reasoning, and validation steps, though it does not follow the repository's template structure intended for icon/platform changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@nathangathright nathangathright merged commit 7aa9fa3 into main May 18, 2026
2 checks passed
@nathangathright nathangathright deleted the codex/react-icons-rsc branch May 18, 2026 12:23
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.

1 participant