PromucFlow_constructor/app/client/src/widgets
Rahul Barwal b23ba1db8f
fix: JSON form validation trigger on child component update (#37128)
## Description
<ins>Problem</ins>

Form validation was not triggered when the child component was updated,
resulting in inconsistent data consistency.

<ins>Root cause</ins>

The `Form` component in
`app/client/src/widgets/JSONFormWidget/component/Form.tsx` did not
include the `trigger` function from the `methods` object, preventing
form validation from being triggered on child component updates.

<ins>Solution</ins>

This PR adds the `trigger` function from the `methods` object to the
`Form` component, ensuring form validation is triggered correctly when
the child component is updated.

* Adds unit tests for `Form` component as well


Fixes #28018
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.JSONForm"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11697880527>
> Commit: 1c38b05c04d9ed2c83d09a90d5fec720e30d4daf
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11697880527&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.JSONForm`
> Spec:
> <hr>Wed, 06 Nov 2024 06:06:41 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced form validation lifecycle management with the introduction of
the `useUnmountFieldValidation` hook for better handling of field
validation upon unmounting.
- Improved testability of the form component through the inclusion of
`data-testid` attributes for the submit and reset buttons.

- **Bug Fixes**
- Resolved edge cases in form validation, ensuring components function
correctly with changing props and handle empty schemas gracefully.

- **Tests**
- Introduced a comprehensive suite of unit tests for the `Form`
component, covering various scenarios including validation and
visibility management.
- Added tests for the new `useUnmountFieldValidation` hook to ensure
correct validation behavior during unmounting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-06 15:48:45 +05:30
..
AudioRecorderWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
AudioWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
BaseInputWidget feat: remove isFocus from meta state in InputWidgetV2 (#36843) 2024-10-16 16:01:07 +05:30
BaseWidgetHOC chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ButtonGroupWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
ButtonWidget chore: remove console errors on dev (#36639) 2024-10-15 00:23:51 +05:30
CameraWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
CategorySliderWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ChartWidget fix: Refactor handling of empty chart data in ChartWidget (#37009) 2024-10-23 14:03:46 +05:30
CheckboxGroupWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
CheckboxWidget chore: enable no-explicit-any rule (#35321) 2024-07-31 18:41:28 +03:00
CircularProgressWidget chore: Move widget deprecation messages from propertyPaneView to individual Widget configurations (#33759) 2024-06-04 11:55:55 +05:30
CodeScannerWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
components chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ContainerWidget chore: decouple widget-config.json from main chunk (#36924) 2024-10-17 20:48:39 +05:30
CurrencyInputWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
CustomWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
DatePickerWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
DatePickerWidget2 chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
DividerWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
DocumentViewerWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
DropdownWidget chore:delete unused files (#36368) 2024-09-19 16:01:03 +03:00
ExternalWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
FilepickerWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
FilePickerWidgetV2 chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
FormButtonWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
FormWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
IconButtonWidget chore: remove console errors on dev (#36639) 2024-10-15 00:23:51 +05:30
IconWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
IframeWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ImageWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
InputWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
InputWidgetV2 feat: remove isFocus from meta state in InputWidgetV2 (#36843) 2024-10-16 16:01:07 +05:30
JSONFormWidget fix: JSON form validation trigger on child component update (#37128) 2024-11-06 15:48:45 +05:30
ListWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ListWidgetV2 chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MapChartWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MapWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MenuButtonWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ModalWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MultiSelectTreeWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MultiSelectWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
MultiSelectWidgetV2 chore: removed old flags for airgap instances (#36609) 2024-10-07 15:26:25 +05:30
NumberSliderWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
PhoneInputWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ProgressBarWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
ProgressWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
RadioGroupWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
RangeSliderWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
RateWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
RichTextEditorWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
SelectWidget chore: removed old flags for airgap instances (#36609) 2024-10-07 15:26:25 +05:30
SingleSelectTreeWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
StatboxWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
SwitchGroupWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
SwitchWidget chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
TableWidget chore:delete unused files (#36368) 2024-09-19 16:01:03 +03:00
TableWidgetV2 fix: Enhance URL handling in table by rendering URL column types with <a> tag. (#37179) 2024-11-06 10:27:57 +05:30
TabsMigrator chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
TabsWidget chore: decouple widget-config.json from main chunk (#36924) 2024-10-17 20:48:39 +05:30
TextWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
VideoWidget chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
BaseComponent.tsx chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> 2023-03-16 17:11:47 +05:30
BaseWidget.tsx chore: chore: add SVGR to appsmith-icon package, add processing for custom icons, update date-fns (#37115) 2024-10-28 14:55:42 +03:00
CanvasWidget.tsx chore: enable no-explicit-any rule (#35321) 2024-07-31 18:41:28 +03:00
ConnectDataOverlay.tsx chore: rename ADS package (#35583) 2024-08-09 17:20:29 +03:00
index.ts chore: move chat widget to EE repo (#36845) 2024-10-14 13:10:28 +03:00
MetaHOC.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
MetaWidgetContextProvider.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
Skeleton.tsx perf: Widget re-rendering refactor (#14485) 2022-08-19 15:40:36 +05:30
SkeletonWidget.tsx feat: implement dropping building blocks on canvas (#31857) 2024-04-16 09:41:09 +01:00
useDropdown.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
utils.test.ts feat: code scanner widget default camera (#26083) 2023-08-10 12:18:51 +05:30
utils.ts feat: code scanner widget default camera (#26083) 2023-08-10 12:18:51 +05:30
WidgetUtils.test.ts chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
WidgetUtils.ts chore: remove console errors on dev (#36639) 2024-10-15 00:23:51 +05:30
withLazyRender.tsx chore: enable no-explicit-any rule (#35321) 2024-07-31 18:41:28 +03:00
withWidgetProps.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00