Skip to content

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

Breaking change refactoring in preparation for the feature in 4736

  • In @rjsf/utils:
    • Added new GlobalFormOptions, refactoring the experimental_componentUpdateStrategy from Registry and idPrefix & idSeparator from FieldProps
    • Replaced the experimental_componentUpdateStrategy prop in Registry with readonly globalFormOptions?: GlobalFormOptions
    • Updated FieldProps to remove idPrefix and idSeparator
  • In @rjsf/core:
    • Updated Form to add the globalFormOptions to the registry if there are any GlobalFormOptions values provided
    • Updated ArrayField, LayoutGridField, ObjectField and SchemaField to get idPrefix, idSeparator from the registry.globalFormOptions, no longer passing them on FieldProps
    • Updated SchemaField to get experimental_componentUpdateStrategy from the registry.globalFormOptions as well
    • Updated the SchemaField tests as needed
  • In @rjsf/daisy updated the snapshots
  • Updated the custom-widget-fields.md and v6.x upgrade guide.md to document the refactor of the idPrefix and idSeparator refactor
  • Updated the CHANGELOG.md file accordingly

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

… of properties

Fixed rjsf-team#4772 by always genering the outer grid
- Updated `chakra-ui`'s `ObjectFieldTemplate` to render the outer `Grid` regardless of the number of properties
- Updated the `CHANGELOG.md` accordingly
const { keyedFormData } = this.state;
const fieldTitle = schema.title || title || name;
const { schemaUtils, formContext } = registry;
const { schemaUtils, formContext, globalFormOptions = {} } = registry;
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like it would be a problem in any of the components in this change, but setting the default value to {} here would create a new object every render. It could cause performance issues if it later got passed to a hook dependency array, which could happen in a future change or in a custom field.

Maybe Form.getDefaultRegistry should create one empty object instead and pass it around everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll go with that

The `customValidate` prop requires a function that specifies custom validation rules for the form.
See [Validation](../usage/validation.md) for more information.

## experimental_componentUpdateStrategy
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this

heath-freenome and others added 2 commits September 20, 2025 08:45
Breaking change refactoring in preparation for the feature in 4736
- In `@rjsf/utils`:
  - Added new `GlobalFormOptions`, refactoring the `experimental_componentUpdateStrategy` from `Registry` and `idPrefix` & `idSeparator` from `FieldProps`
  - Replaced the `experimental_componentUpdateStrategy` prop in `Registry` with `readonly globalFormOptions?: GlobalFormOptions`
  - Updated `FieldProps` to remove `idPrefix` and `idSeparator`
- In `@rjsf/core`:
  - Updated `Form` to add the `globalFormOptions` to the registry if there are any `GlobalFormOptions` values provided
  - Updated `ArrayField`, `LayoutGridField`, `ObjectField` and `SchemaField` to get `idPrefix`, `idSeparator` from the `registry.globalFormOptions`, no longer passing them on `FieldProps`
  - Updated `SchemaField` to get `experimental_componentUpdateStrategy` from the `registry.globalFormOptions` as well
  - Updated the `SchemaField` tests as needed
- In `@rjsf/daisy` updated the snapshots
- Updated the `custom-widget-fields.md` and `v6.x upgrade guide.md` to document the refactor of the `idPrefix` and `idSeparator` refactor
- Updated the `CHANGELOG.md` file accordingly
Comment on lines 966 to 968
const globalFormOptions = JSON.parse(
JSON.stringify({ idPrefix, idSeparator, experimental_componentUpdateStrategy }),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will not work if #4773 adds the nameGenerator function prop since it couldn't be be stringified/parsed.

Could you use lodash omitBy/isUndefined?

Suggested change
const globalFormOptions = JSON.parse(
JSON.stringify({ idPrefix, idSeparator, experimental_componentUpdateStrategy }),
);
const globalFormOptions = omitBy({ idPrefix, idSeparator, experimental_componentUpdateStrategy }, isUndefined)

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try that!

Copy link
Member Author

Choose a reason for hiding this comment

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

I went with isNil() rather than isUndefined() because we were already including it

@heath-freenome heath-freenome merged commit e1aa673 into rjsf-team:main Sep 20, 2025
4 checks passed
@heath-freenome heath-freenome deleted the prep-work-for-4736 branch September 20, 2025 18:10
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.

2 participants