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

Leverage SourceContext in fields #9620

Merged
merged 14 commits into from
Feb 26, 2024
Merged

Leverage SourceContext in fields #9620

merged 14 commits into from
Feb 26, 2024

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Jan 29, 2024

  • Use SourceContext for TranslatableFields
  • Introduce useFieldValue to get a record value
  • Document useFieldValue

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

I see a regression in the TranslatableFields storybook: labels are no longer translated

docs/Fields.md Show resolved Hide resolved
docs/useFieldValue.md Outdated Show resolved Hide resolved
docs/useFieldValue.md Outdated Show resolved Hide resolved
packages/ra-core/src/util/useFieldValue.ts Outdated Show resolved Hide resolved
packages/ra-core/src/util/useFieldValue.ts Outdated Show resolved Hide resolved
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

Almost there!

docs/Fields.md Outdated Show resolved Hide resolved
docs/useFieldValue.md Show resolved Hide resolved
docs/useFieldValue.md Show resolved Hide resolved
docs/useFieldValue.md Show resolved Hide resolved
docs/Fields.md Show resolved Hide resolved
packages/ra-core/src/util/useFieldValue.ts Outdated Show resolved Hide resolved
packages/ra-core/src/util/useFieldValue.ts Show resolved Hide resolved
Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

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

One more thing: I see TS errors about source in both stories and tests files in my IDE. Do you see them too?

2024-02-20_11-10_1

2024-02-20_11-10

EDIT: Nevermind that. I only built ra-core but actually it requires building all packages to make the errors go away.

docs/Fields.md Outdated Show resolved Hide resolved
docs/useFieldValue.md Outdated Show resolved Hide resolved
docs/useFieldValue.md Outdated Show resolved Hide resolved
docs/useFieldValue.md Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/field/types.ts Show resolved Hide resolved
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
docs/useFieldValue.md Outdated Show resolved Hide resolved
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
@fzaninotto
Copy link
Member

Still missing a section in the upgrade guide for custom fields

@slax57 slax57 added this to the 5.0.0 milestone Feb 26, 2024
@slax57 slax57 merged commit f568a02 into next Feb 26, 2024
2 checks passed
@slax57 slax57 deleted the source-context-fields branch February 26, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants