[Components] Fix order of execution of the events with individual, child and parent component
@johnsoncherian is already working on this.
Since Jul 10, 2024.
- Dominant language
- JavaScript
- Stars
- 40.9k
- Forks
- 5.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 202
Description
Description:
Child component (e.g., datepicker) interacts with the parent form component. When a user selects a date in the child component, its onChange event might fire before the parent form data is updated to reflect the new selection. This can lead to us querying the form data within the onChange handler and getting outdated information.
This behavior is also seen with the individual component's,
Example: Select component, with On Select event handler which does a Show Alert. It displays the old selectedOptionLabel not the newly selected label.
For now solution is adding debounce to your the respective event handler.
Solution:
Fix order of execution of the events with individual, child and parent component for storing and accessing the updated data.
Steps to reproduce the issue:
- Select a date in the child datepicker component which is inside Form parent component.
- The child component's onChange event fires.
- We attempt to access the updated form data within the onChange handler, but it might still contain the old value because the update hasn't propagated yet.
Note:
Technical solution is yet to be finalized
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.