Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SchemaField: Only use nullish coalescing with uiOptions when computing readonly #4238

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

nickgros
Copy link
Contributor

@nickgros nickgros commented Jul 2, 2024

Reasons for making this change

Fixes #4236

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

@nickgros nickgros mentioned this pull request Jul 2, 2024
8 tasks
@@ -151,7 +151,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e

const FieldComponent = getFieldComponent<T, S, F>(schema, uiOptions, idSchema, registry);
const disabled = Boolean(uiOptions.disabled ?? props.disabled);
const readonly = Boolean(uiOptions.readonly ?? props.readonly ?? props.schema.readOnly ?? schema.readOnly);
const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
Copy link
Contributor Author

@nickgros nickgros Jul 2, 2024

Choose a reason for hiding this comment

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

Fixes case where readonly should be true when props.readonly is false and props.schema.readOnly is true.

In other words, revert to the behavior before #4212, except allow uiOptions.readOnly to override other readonly values as originally intended in that PR

@heath-freenome heath-freenome merged commit 3fc9eba into rjsf-team:main Jul 2, 2024
5 checks passed
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.

Regression: readOnly not working in 5.18.5
2 participants