Skip to content

fix(arktype-utils): Ensures keys are set on the correct object in an array#24

Merged
jhechtf merged 1 commit intomainfrom
fix/grouping-error
Sep 2, 2025
Merged

fix(arktype-utils): Ensures keys are set on the correct object in an array#24
jhechtf merged 1 commit intomainfrom
fix/grouping-error

Conversation

@jhechtf
Copy link
Copy Markdown
Owner

@jhechtf jhechtf commented Sep 2, 2025

Fix bug in form data object grouping

Fixes a bug in the formDataToObject function where complex arrays and object combinations weren't being grouped correctly. The issue was in the logic that determines when to push the current object to the array and start a new one.

The PR adds a test case for complex array/object combinations and updates the grouping logic to:

  • Track the last field processed
  • Only push the current object when a non-array field repeats
  • Check if the field is an array field before deciding to push

This ensures proper grouping of form data like bills[].id and bills[].name into structured objects.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: 6478575

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@jhecht/arktype-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Owner Author

jhechtf commented Sep 2, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jhechtf jhechtf marked this pull request as ready for review September 2, 2025 18:54
@jhechtf jhechtf merged commit 41c62b2 into main Sep 2, 2025
4 checks passed
@jhechtf jhechtf deleted the fix/grouping-error branch September 2, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant