Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Buttons Props #7750

Merged
merged 1 commit into from
May 24, 2022
Merged

Simplify Buttons Props #7750

merged 1 commit into from
May 24, 2022

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented May 24, 2022

No description provided.

@djhi djhi added the RFR Ready For Review label May 24, 2022
@djhi djhi added this to the 4.1.1 milestone May 24, 2022
@vercel vercel bot temporarily deployed to Preview – react-admin May 24, 2022 10:38 Inactive
@slax57 slax57 merged commit 05e6159 into master May 24, 2022
@slax57 slax57 deleted the simplify-button-props branch May 24, 2022 12:50
@@ -38,7 +32,9 @@ export type LocationDescriptor = Partial<Path> & {
* </Button>
*
*/
export const Button = (props: ButtonProps) => {
export const Button = <RecordType extends RaRecord = RaRecord>(
Copy link
Member

Choose a reason for hiding this comment

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

should default to any

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I failt to see why there is a record prop. This should be handled by the specialized buttons only imo

@@ -102,7 +98,7 @@ export const Button = (props: ButtonProps) => {
);
};

interface Props {
interface Props<RecordType extends RaRecord = RaRecord> {
Copy link
Member

Choose a reason for hiding this comment

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

Same, I think this is a breaking change

// May be injected by Toolbar
record?: RaRecord;
// May be provided manually
record?: RecordType;
Copy link
Member

Choose a reason for hiding this comment

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

In fact, I fail to see what record does here. It's not even used in the code. This somehow seems to forbid usage of the generic Button outside of a record context, e.g. in a List, a dialog, a sidebar, or a custom page. I wonder why, as Button is purely a UI component.

@fzaninotto
Copy link
Member

Could you please update the description to explain what problem this PR fixes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants