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

[Doc] Document useSourceContext and improve useSimpleFormIteratorItem documentation #10547

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

slax57
Copy link
Contributor

@slax57 slax57 commented Feb 24, 2025

Problem

  1. RA v5 introduced the <SourceContext>, which removes the need for several components to clone their children, and also removes the need to call getSource in user-land inside <FormDataConsumer>.
    However, users may still need to use getSource for some more advanced usages, like changing a value programmatically using RHF's setValue.

  2. In our doc, we only use useSimpleFormIteratorItem to remove or reorder.
    However, if I need to use the index of my SimpleFormIterator the doc only mentiones getItemLabel which is not enough

Solution

  1. Document the new getSource (coming from the <SourceContext>) where it could be needed:
  • <ArrayInput>
  • <TranslatableInputs>
  • Upgrade guide
  • <ReferenceManyInput>
  • <ReferenceOneInput>
  1. Add a section in the SimpleFormIterator doc, after the Props description, titled ‘Getting The Element Index’, and document the total and index values of useSimpleFormIteratorItem

How To Test

Additional Checks

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

Also, please make sure to read the contributing guidelines.

@slax57 slax57 added the WIP Work In Progress label Feb 24, 2025
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.

1 participant