Skip to content

fix: support .jsx, .ts, .js extensions in named layout resolution - #420

Merged
ariskemper merged 1 commit into
mainfrom
fix/layout-entity-missing-extensions
Feb 23, 2026
Merged

ariskemper merged 1 commit into
mainfrom
fix/layout-entity-missing-extensions

Conversation

@ariskemper

@ariskemper ariskemper commented Feb 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • getLayoutEntity only checked .mdx, .md, .tsx when resolving named layouts — missing .jsx, .ts, .js
  • Files in the top-level layouts/ directory (e.g. layouts/main.jsx) weren't found because detectEntityType only classifies by filename/frontmatter, not directory context

Changes

  • Added .jsx, .ts, .js to all three lookup groups in getLayoutEntity (layouts/, components/XLayout, components/Layout)
  • getLayoutEntity now promotes any valid entity from the layouts/ directory to a layout, while still requiring name/frontmatter-based detection for components/ paths
  • detectEntityType is left unchanged — no parentDir heuristic that could misclassify route pages under pages/layouts/

Test plan

  • All existing getEntityInfo tests pass
  • 5 new tests for .jsx/.ts/.js layouts in layouts/ and components/ directories
  • New test confirming pages/layouts/index.tsx is correctly classified as a page (not a layout)
  • Manually verified with basic-mdx example using layouts/main.jsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1f9df9f1e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/types/entities.ts Outdated
@ariskemper
ariskemper force-pushed the fix/layout-entity-missing-extensions branch from b1f9df9 to 72a453b Compare February 23, 2026 10:14
getLayoutEntity only checked .mdx, .md, .tsx when resolving named
layouts. Files in layouts/ are now treated as layouts by convention
in getLayoutEntity without modifying detectEntityType, avoiding
misclassification of route pages under pages/layouts/.
@ariskemper
ariskemper force-pushed the fix/layout-entity-missing-extensions branch from 72a453b to db7225b Compare February 23, 2026 10:17
@ariskemper
ariskemper merged commit 2e9f80b into main Feb 23, 2026
13 checks passed
@ariskemper
ariskemper deleted the fix/layout-entity-missing-extensions branch February 23, 2026 10:22
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