Open
Description
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: