-
-
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
Introduce SourceContext #9533
Introduce SourceContext #9533
Conversation
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx
Show resolved
Hide resolved
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.
Just two minor omissions in the documentation otherwise it looks good to me
packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIteratorItem.tsx
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIteratorItem.tsx
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/TranslatableInputsTabContent.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/input/TranslatableInputsTabContent.tsx
Outdated
Show resolved
Hide resolved
); | ||
screen.getByText('Label for title'); | ||
}); | ||
}); |
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.
I think we're missing tests cases for sources with dots and / or inside ArrayInputs.
packages/ra-ui-materialui/src/input/TranslatableInputsTabContent.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Francois Zaninotto <francois@marmelab.com>
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIteratorItem.tsx
Outdated
Show resolved
Hide resolved
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.
minor remarks
ret = children({ formData, scopedFormData, getSource, ...rest }); | ||
if (matches) { | ||
const scopedFormData = get(formData, matches[0]); | ||
ret = children({ formData, scopedFormData, ...rest }); |
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.
sure
Co-authored-by: Francois Zaninotto <francois@marmelab.com>
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.
Otherwise it's good to me, we're so close!! 😁
packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.stories.tsx
Outdated
Show resolved
Hide resolved
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.
🎉 🎉 🎉
Problem
We need to prefix sources in multiple cases: ArrayInput + SimpleFormIterator, and many EE components.
To do that we currently clone children.
Solution
This is avoidable by introducing a context that useInput would use to set the source.
It’s a breaking change though for custom inputs that don’t use
useInput
.