Skip to content

Make catalogue component lookup casing-tolerant#2563

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/case-insensitive-catalogue-lookup
Draft

Make catalogue component lookup casing-tolerant#2563
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/case-insensitive-catalogue-lookup

Conversation

@posthog

@posthog posthog Bot commented Jul 2, 2026

Copy link
Copy Markdown

Summary

The React reconciler resolves JSX element names against the catalogue with an exact-match lookup (catalogue[type]), which throws "Unsupported component type" for casing typos. The catalogue only registers each component under its PascalCase class name (PowerSource) and a fully-lowercased alias (powersource), so a camelCase tag like <powerSource> matches neither and blows up even though the component clearly exists.

This adds a lowercased fallback (catalogue[type] ?? catalogue[type.toLowerCase()]) before throwing, so powerSource / PowerSource / powersource all resolve to the same component. It's a one-line change that kills this whole class of casing errors for every component in the catalogue.

Why

A user hit this error from a <powerSource> camelCase typo. The error message points at a nonexistent registration bug, sending people hunting in the wrong place. The fix makes the lookup typo-tolerant so a casing mistake resolves cleanly instead.

Test plan

Added tests/fiber/camelcase-component-fallback.test.tsx asserting camelCase and PascalCase string element types resolve to the same constructor as the canonical lowercase element. bunx tsc --noEmit passes.


Created with PostHog Code from an inbox report.

Fall back to a lowercased catalogue lookup in the reconciler so casing typos like <powerSource> resolve to the registered component instead of throwing "Unsupported component type".

Generated-By: PostHog Code
Task-Id: 0d99d5ae-142e-46db-afff-5346e4da7e51
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment Jul 2, 2026 10:15pm

Request Review

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants