Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mandatory date column enforcement (#35613)
## Description **Problem:** When the `isRequired` property is set for date columns in the table widget, the validation doesn't work as expected. Users can add new rows without filling in the date field, even though it is marked as required. This results in rows being added with missing date values, which can lead to incomplete or invalid data entries. **Root Cause:** The validation logic for the date column is currently handled within the DateCell component. However, the isRequired validation functionality was not implemented within this component. Additionally, the general validation logic in the `getEditableCellValidity` function, located in the derived.js file, does not account date cells in its isRequired validation. **Solution:** To fix this issue: **Enhance the `getEditableCellValidity` function:** Extend the existing validation logic in getEditableCellValidity to include the date cell in its validation, specifically checking for the isRequired property. **Integrate with DateCell validation:** Ensure that the isRequired validation is properly executed in conjunction with the existing date validations inside the DateCell component. This will enforce the requirement and prevent new rows from being added if the date field is left empty. **Test Plan** https://www.notion.so/appsmith/Test-Plan-Date-Column-Marked-as-Required-Doesn-t-Enforce-Mandatory-Entry-When-Adding-New-Table-Row-c73b764af60842a188cba056bdda6d79?pvs=4 Fixes #34258 ## Automation /ok-to-test tags="@tag.All" ### 🔍 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/10453174231> > Commit: 40fe2ea > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10453174231&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 19 Aug 2024 13:17:23 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced validation for "Date" column types, ensuring that required fields are correctly enforced. - **Enhancements** - Improved validation logic for more accurate user feedback in date cells. - Expanded support for validating "date" columns in the table widget. - **Bug Fixes** - Enhanced error handling to ensure proper indication of cell validity based on new validation criteria. - Updated visual feedback for cell editor state in the UI. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information