CMS editor: opening an .mdx file gets an error

Open Beginner friendly
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
nextjs, typescript
Domain
frontend, web-dev

Research direction

Inspect components/cms/FileEditor.tsx around lines 335-359, where the open-file tabs are rendered, and reproduce the issue by opening an .mdx file in the CMS at app/admin/(dashboard)/cms/page.tsx. The fix is complete when the file tab controls no longer produce a nested-button hydration error in the console.

Written by the indexing model from the issue text.

Description

## Error Type
Console Error

## Error Message
In HTML, <button> cannot be a descendant of <button>.
This will cause a hydration error.

  ...
    <RedirectBoundary>
      <RedirectErrorBoundary router={{...}}>
        <InnerLayoutRouter url="/admin/cms" tree={[...]} params={{}} cacheNode={{rsc:<Fragment>, ...}} ...>
          <SegmentViewNode type="page" pagePath="/toolkata/...">
            <SegmentTrieNode>
            <ClientPageRoot Component={function CMSPage} serverProvidedParams={{...}}>
              <CMSPage params={Promise} searchParams={Promise}>
                <div className="flex flex-...">
                  <div>
                  <div className="flex-1 fle...">
                    <div>
                    <div className="flex-1 fle...">
                      <FileEditor files={[...]} activeFileIndex={0} ...>
                        <div className="flex flex-...">
                          <div className="flex items..." role="tablist" aria-label="Open files">
>                           <button
>                             type="button"
>                             role="tab"
>                             aria-selected={true}
>                             aria-controls="editor-panel-0"
>                             onClick={function onClick}
>                             onMouseDown={function onMouseDown}
>                             className="group flex items-center gap-1.5 px-3 py-1.5 text-xs font-mono rounded-t trans..."
>                           >
                              <span>
                              <span>
>                             <button
>                               type="button"
>                               onClick={function onClick}
>                               className="ml-1 p-0.5 rounded text-[var(--color-text-dim)] hover:text-[var(--color-err..."
>                               aria-label="Close glossary.ts"
>                             >
                          ...
                    ...
                  ...
          ...
        ...



    at button (<anonymous>:null:null)
    at <unknown> (components/cms/FileEditor.tsx:359:13)
    at Array.map (<anonymous>:null:null)
    at FileEditor (components/cms/FileEditor.tsx:335:16)
    at CMSPage (app/admin/(dashboard)/cms/page.tsx:740:13)

## Code Frame
  357 |               />
  358 |             )}
> 359 |             <button
      |             ^
  360 |               type="button"
  361 |               onClick={(e) => {
  362 |                 e.stopPropagation()

Next.js version: 16.1.4 (Turbopack)
Dominant language
TypeScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hmemcpy/toolkata

All issues in hmemcpy/toolkata

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.