Skip to content

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Sep 24, 2025

Reasons for making this change

Fixed #4765 by supporting objects and arrays as elements in a grid, specifically fixing the onFieldChange() to support them

  • Updated LayoutGridField to update the onFieldChange() method to take an additional parameter, schemaType
    • If schemaType is object or array, then the actualPath returned to the parent onChange will append the path from the onChange() to the dottedPath
    • Updated the tests to verify this new behavior
  • Updated getTestRegistry() to support passing in globalFormOptions instead of just setting an empty object

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

This example will work when merged as shown here:

Screen.Recording.2025-09-23.at.5.50.42.PM.mov

Fixed rjsf-team#4765 by supporting objects and arrays as elements in a grid, specifically fixing the `onFieldChange()` to support them
- Updated `LayoutGridField` to update the `onFieldChange()` method to take an additional parameter, `schemaType`
  - If `schemaType` is `object` or `array`, then the `actualPath` returned to the parent `onChange` will append the `path` from the `onChange()` to the `dottedPath`
  - Updated the tests to verify this new behavior
- Updated `getTestRegistry()` to support passing in `globalFormOptions` instead of just setting an empty object
Copy link
Member Author

@heath-freenome heath-freenome Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickgros I've been considering exporting this function from the main index.ts of @rjsf/core so that people can use it as a starting point. Thoughts?? Of course it would mean moving it to be a sibling of getDefaultRegistry()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's actually useful to export, it should be fine.

@heath-freenome heath-freenome merged commit ba61a8a into rjsf-team:main Sep 24, 2025
4 checks passed
@heath-freenome heath-freenome deleted the fix-4765 branch September 24, 2025 17:56
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.

LayoutGridField causes array items to collapse when edited all themes

2 participants