Skip to content

Conversation

@chmielulu
Copy link
Contributor

What?

TypeScript says that it is possible to modify the tab of the default view however, when you specify the path to the custom component, nothing happens. I fixed it.

How?

If a Component for the tab of the default view is defined in the config, I return that Component instead of DocumentTab

Example Configuration

config.ts

export const MenuGlobal: GlobalConfig = {
  slug: menuSlug,
  fields: [
    {
      name: 'globalText',
      type: 'text',
    },
  ],
  admin: {
    components: {
      views: {
        edit: {
          api: {
            tab: {
              Component: './TestComponent.tsx',
            },
          },
        },
      },
    },
  },
}

./TestComponent.tsx

const TestComponent = () => 'example'

export default TestComponent

Before

Screenshot 2025-03-20 at 08 42 06

After

Screenshot 2025-03-20 at 08 43 06

@chmielulu chmielulu changed the title fix: cannot override tab of default view fix(next): cannot override tab of default view Mar 20, 2025
@jacobsfletch jacobsfletch self-requested a review March 21, 2025 19:38
@chmielulu
Copy link
Contributor Author

Hi @jacobsfletch, what is the status of my PR? It's a blocker for my task.

@jacobsfletch
Copy link
Member

@chmielulu this looks good! One last thing to do here is to add a test. This can be done in admin test suite. You can see how we do this for other tab-related features here:

Component: '/components/views/CustomTabComponent/index.js#CustomTabComponentView',
. Just reuse this same component in place of one of the default tabs.

@chmielulu chmielulu force-pushed the fix/cannot-override-tab-of-default-view branch 2 times, most recently from 7db122d to 5c38773 Compare April 17, 2025 21:37
@chmielulu chmielulu force-pushed the fix/cannot-override-tab-of-default-view branch from 5c38773 to fac4d90 Compare April 17, 2025 21:42
@chmielulu
Copy link
Contributor Author

@jacobsfletch I've added tests :)

@chmielulu
Copy link
Contributor Author

@jacobsfletch Just a friendly reminder, thanks in advance! 😃

@github-actions github-actions bot added the stale label Jun 2, 2025
@chmielulu
Copy link
Contributor Author

Bump.

@jacobsfletch what is the status of my PR?

@jacobsfletch jacobsfletch changed the title fix(next): cannot override tab of default view fix(next): cannot override tab of default views Jun 2, 2025
Copy link
Member

@jacobsfletch jacobsfletch left a comment

Choose a reason for hiding this comment

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

Looks good!

@jacobsfletch jacobsfletch merged commit c639c5f into payloadcms:main Jun 2, 2025
150 of 152 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Jun 5, 2025

🚀 This is included in version v3.41.0

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants