-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Simplify Buttons Props #7750
Conversation
@@ -38,7 +32,9 @@ export type LocationDescriptor = Partial<Path> & { | |||
* </Button> | |||
* | |||
*/ | |||
export const Button = (props: ButtonProps) => { | |||
export const Button = <RecordType extends RaRecord = RaRecord>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should default to any
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
Could you please update the description to explain what problem this PR fixes? |
No description provided.