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

[data grid] Improve localization dx for custom filters #13256

Open
MBilalShafi opened this issue May 26, 2024 · 0 comments
Open

[data grid] Improve localization dx for custom filters #13256

MBilalShafi opened this issue May 26, 2024 · 0 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! dx Related to developers' experience enhancement This is not a bug, nor a new feature feature: Filtering on header Related to the header filtering (Pro) feature feature: Filtering Related to the data grid Filtering feature l10n localization

Comments

@MBilalShafi
Copy link
Member

MBilalShafi commented May 26, 2024

IMHO this is a bad practice:

const label =
  op?.headerLabel ??
  apiRef.current.getLocaleText(
    `headerFilterOperator${capitalize(op.value)}` as 'headerFilterOperatorContains',
  );

It crashes even though the headerLabel is supposed to be optional.
Not sure how we could improve it (wrap in a try to avoid crashing and render an empty label? check if the translation key exists before calling getLocaleText? Create a getOptionalLocaleText method?), but right now it's a bad DX.

To be clear, this code have been here for ages, it's not a new problem at all, it was already here when I was working on the grid.

Originally posted by @flaviendelangle in #13217 (comment)

Search keywords:

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 26, 2024
@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! l10n localization feature: Filtering Related to the data grid Filtering feature dx Related to developers' experience enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 26, 2024
@MBilalShafi MBilalShafi added the feature: Filtering on header Related to the header filtering (Pro) feature label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! dx Related to developers' experience enhancement This is not a bug, nor a new feature feature: Filtering on header Related to the header filtering (Pro) feature feature: Filtering Related to the data grid Filtering feature l10n localization
Projects
None yet
Development

No branches or pull requests

1 participant