Skip to content

[Bug]: Resetting JSON Form creates an empty Array item for Array fields defaulted to [] (#41653) #41704

@Arbab1308

Description

@Arbab1308

Is there an existing issue for this?

  • I have searched the existing issues

Description

Stack: React / State Management / Formik (Frontend)

Steps To Reproduce

Implementation Logic:

Trace the Reset Action: Locate the JSONFormWidget logic, specifically the function that handles the resetForm action.

Identify the Flaw: When a form resets, it tries to re-initialize fields based on schema. For arrays, Appsmith likely has a fallback logic that says: "If an array field is initialized, push at least one empty object {} so the user has a row to type in."

The Fix: Add a strict equality/type check during the reset cycle. If the user explicitly set the defaultValue of that specific field to an empty array [], bypass the auto-append logic. Force the local component state to remain [] rather than mutating to [{}]

Public Sample App

No response

Environment

Production

Severity

Low (Cosmetic UI issues)

Issue video log

No response

Version

cloud / self Hosted 1.6.6

Metadata

Metadata

Labels

BugSomething isn't workingNeeds TriagingNeeds attention from maintainers to triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions