Skip to content

[TypeScript] Fix ref type regression when wrapping react-admin Button components#11135

Merged
Madeorsk merged 4 commits intomasterfrom
fix-editbutton-ref-props
Jan 26, 2026
Merged

[TypeScript] Fix ref type regression when wrapping react-admin Button components#11135
Madeorsk merged 4 commits intomasterfrom
fix-editbutton-ref-props

Conversation

@WiXSL
Copy link
Collaborator

@WiXSL WiXSL commented Jan 23, 2026

Fixes #11134

How to Test

Create a small wrapper around EditButtonProps (like the one from issue #11134):

import { EditButton, EditButtonProps } from 'react-admin';

type Props = Omit<EditButtonProps, 'label'> & {
  source: string;
  text?: string;
  label?: string;
};

export const EditButtonEx = ({ source, text, ...rest }: Props) => (
  <EditButton {...rest} label={text} />
);

EditButton renders a MUI Button with component={LinkBase} + forwardRef, so its props should be typed as ButtonProps<typeof LinkBase> (not the default button props). This aligns EditButton, CloneButton, and ListButton with the existing pattern used by ShowButton.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

@Madeorsk Madeorsk merged commit e89d57c into master Jan 26, 2026
15 checks passed
@Madeorsk Madeorsk deleted the fix-editbutton-ref-props branch January 26, 2026 09:09
@fzaninotto fzaninotto changed the title [Fix] Buttons ref props [TypeScript] Fix ref type regression when wrapping react-admin Button components Jan 26, 2026
@fzaninotto fzaninotto added this to the 5.14.1 milestone Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Development

Successfully merging this pull request may close these issues.

Type mismatch in ref attribute in EditButton and EditButtonProps

3 participants