Skip to content

Commit 0e3e471

Browse files
committedFeb 12, 2021
Apply Review
1 parent 06ff1e8 commit 0e3e471

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎packages/ra-ui-materialui/src/form/Toolbar.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ const Toolbar: FC<ToolbarProps> = props => {
161161
Children.map(children, (button: ReactElement) =>
162162
button && isValidElement<any>(button)
163163
? React.cloneElement(button, {
164-
basePath,
164+
basePath: valueOrDefault(
165+
button.props.basePath,
166+
basePath
167+
),
165168
handleSubmit: valueOrDefault(
166169
button.props.handleSubmit,
167170
handleSubmit
@@ -173,8 +176,14 @@ const Toolbar: FC<ToolbarProps> = props => {
173176
onSave: button.props.onSave,
174177
invalid,
175178
pristine,
176-
record,
177-
resource,
179+
record: valueOrDefault(
180+
button.props.record,
181+
record
182+
),
183+
resource: valueOrDefault(
184+
button.props.resource,
185+
resource
186+
),
178187
saving,
179188
submitOnEnter: valueOrDefault(
180189
button.props.submitOnEnter,
@@ -184,7 +193,6 @@ const Toolbar: FC<ToolbarProps> = props => {
184193
button.props.undoable,
185194
undoable
186195
),
187-
...button.props,
188196
})
189197
: null
190198
)

0 commit comments

Comments
 (0)
Please sign in to comment.