PromucFlow_constructor/app/client
Rahul Barwal 0af11b9128
fix: when value of array is empty, no need for data type recalculation (#38794)
## Description
<ins>Problem</ins>
When we have a `select/multi-select` field type and the source data
gives empty array to the `JSONFormWidget`, the widget tries to gauge the
sub type for value inside the array, and since it is empty it got
`undefined`

This led to re-evaluation of property config for the field. 

<ins>Solution</ins>
- Added a check to prevent unnecessary recalculation of sub data types
when arrays are empty in `checkIfArrayAndSubDataTypeChanged`.

- Changed parameter type from `any` to `unknown` in `dataTypeFor` and
`subDataTypeFor` functions for improved type safety.

- Added and refactored unit tests.

This refactor enhances type safety and optimizes performance in the
schema parsing logic.

Fixes #37246  
_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/12905055896>
> Commit: cad7015881c16a9af273b84dcf44cc33e32fb7d9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12905055896&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.JSONForm`
> Spec:
> <hr>Wed, 22 Jan 2025 09:50:23 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

- **Tests**
	- Enhanced test suite for determining field types.
- Added comprehensive test cases covering primitive values, email
formats, date formats, array types, object types, and edge cases.

- **Refactor**
- Updated type annotations in schema parser functions to improve type
safety.
	- Changed parameter types from `any` to `unknown`.
	- Added clarifying comment for handling empty arrays in type checking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-23 15:14:49 +05:30
..
.husky
.yarn
cypress fix: Update button property text (#38758) 2025-01-21 10:39:30 +05:30
docker/templates chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
generators
packages fix: Update button property text (#38758) 2025-01-21 10:39:30 +05:30
public chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
src fix: when value of array is empty, no need for data type recalculation (#38794) 2025-01-23 15:14:49 +05:30
test chore: Remove style from editor and setting config (#38756) 2025-01-23 13:29:03 +05:30
typings
.babelrc
.dockerignore
.editorconfig
.eslintrc.base.json feat: add react-compiler eslint plugin (#37139) 2024-10-31 16:40:18 +01:00
.eslintrc.js
.fork-ts-checkerrc
.gitignore
.lintstagedrc.json
.nvmrc
.prettierignore
.prettierrc
.sentryclirc
.yarnrc.yml
build.sh chore: Increase max-old-space-size to 8192 (#38768) 2025-01-20 13:51:36 +05:30
craco.build.config.js chore: disable sourcemaps for non-prod builds and cleanup craco configs (#38706) 2025-01-17 12:35:34 +03:00
craco.common.config.js chore: disable sourcemaps for non-prod builds and cleanup craco configs (#38706) 2025-01-17 12:35:34 +03:00
craco.dev.config.js chore: disable sourcemaps for non-prod builds and cleanup craco configs (#38706) 2025-01-17 12:35:34 +03:00
cypress_ci_custom.config.ts
cypress_ci_hosted.config.ts
cypress_ci.config.ts
cypress-add-tags.js
cypress.config.ts
download-assets.js
jest.config.js chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
knip.json chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
package.json feat: custom eslint rule infra (#38345) 2025-01-02 17:41:55 +05:30
README.md
README.old.md
start-caddy.sh
start-https.sh chore: Find version after backend is ready (#37861) 2024-11-29 18:57:57 +05:30
tailwind.config.js
tsconfig.json
tsconfig.path.json
vercel.json
yarn.lock feat: custom eslint rule infra (#38345) 2025-01-02 17:41:55 +05:30

Appsmith Client

This project was bootstrapped with Create React App.

For details on setting up your development machine, please refer to the Setup Guide