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

Allow description and deprecated as a function with context #8458

Open
fvieira opened this issue Jan 30, 2025 · 0 comments
Open

Allow description and deprecated as a function with context #8458

fvieira opened this issue Jan 30, 2025 · 0 comments

Comments

@fvieira
Copy link

fvieira commented Jan 30, 2025

While readOnly and hidden are able to react to other fields values through context, description and deprecated are static.
We often need to write description like:

description: `
Case 1: description for case 1
Case 2: description for case 2
`

while case 1 only occurs if the data is in one state and case 2 in another, and so we'd rather just show the right description according to the current data.
deprecated has the same issue, but worse, since even if we make the reason conditional, the
deprecated yellow text is always there.

What I'd like to have is this, just like on readOnly and hidden:

description: (context) => context.parent.someField === 'state1' ? 'description for case 1' : 'description for case 2'
deprecated: (context) => context.parent.someField === 'state1' ? {reason: 'some reason'} : undefined // (or false)
@fvieira fvieira changed the title Allow description as a function with context Allow description and deprecated as a function with context Jan 30, 2025
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

No branches or pull requests

1 participant