Observation-class finding, filed unassigned while implementing #5587. Found by the over-delete sweep for that card, not by looking for it.
What is there
#5587 removes a ref wrapped around an i18n resolver in packages/plugin-charts/src/ObjectChart.tsx. Sweeping the repo for other readers of the symbol being deleted turned up a second, independent instance of the same workaround in a different package:
packages/plugin-dashboard/src/ObjectPivotTable.tsx:83-93
// i18n: translate field display labels and select option labels via the
// standard object/field translation conventions. Held behind refs so the
// metadata-derivation effect doesn't need them in its dep array (the i18n
// hook returns fresh function identities each render).
const { fieldLabel, fieldOptionLabel } = useSafeFieldLabel();
const fieldLabelRef = useRef(fieldLabel);
const fieldOptionLabelRef = useRef(fieldOptionLabel);
useEffect(() => {
fieldLabelRef.current = fieldLabel;
fieldOptionLabelRef.current = fieldOptionLabel;
}, [fieldLabel, fieldOptionLabel]);
Read at lines 108 and 116, inside the metadata-derivation effect whose dep array is [dataSource, schema.objectName] (line 127).
The stated reason — "the i18n hook returns fresh function identities each render" — is the same condition #5564 measured and PR #5585 fixed, so the same precondition is gone here too.
Why it is filed rather than folded into #5587
Deliberately not included in #5587's PR. It is a different package (plugin-dashboard, which declares @object-ui/i18n at package.json:30), a different test suite, and — this is the part that makes it a separate review rather than a mechanical repeat — the ref hides the resolvers from a metadata-derivation effect rather than from a fetch callback. Removing it changes when that effect re-runs and what it re-derives, which is not the same behaviour question #5587 answers, and it deserves its own before/after test rather than riding along.
Suggested shape, if queued
Mirror #5587: drop both refs, depend on fieldLabel / fieldOptionLabel directly in the effect's dep array, and pin it with a test that counts effect runs (or getObjectSchema calls) across re-renders both inside and outside a provider. #5587's ObjectChart.fieldOptionLabelRefetch.test.tsx is a usable template, including the ordering note about createI18n registering a process-global instance.
Worth checking as part of that work whether the two derived state maps (setFieldLabelMaps / setFieldNameLabels) can settle, since a direct dependency puts them in a loop's path the same way fetchData was in #5587's.
Related: #5587, #5564, #5585.
Observation-class finding, filed unassigned while implementing #5587. Found by the over-delete sweep for that card, not by looking for it.
What is there
#5587 removes a ref wrapped around an i18n resolver in
packages/plugin-charts/src/ObjectChart.tsx. Sweeping the repo for other readers of the symbol being deleted turned up a second, independent instance of the same workaround in a different package:packages/plugin-dashboard/src/ObjectPivotTable.tsx:83-93Read at lines 108 and 116, inside the metadata-derivation effect whose dep array is
[dataSource, schema.objectName](line 127).The stated reason — "the i18n hook returns fresh function identities each render" — is the same condition #5564 measured and PR #5585 fixed, so the same precondition is gone here too.
Why it is filed rather than folded into #5587
Deliberately not included in #5587's PR. It is a different package (
plugin-dashboard, which declares@object-ui/i18natpackage.json:30), a different test suite, and — this is the part that makes it a separate review rather than a mechanical repeat — the ref hides the resolvers from a metadata-derivation effect rather than from a fetch callback. Removing it changes when that effect re-runs and what it re-derives, which is not the same behaviour question #5587 answers, and it deserves its own before/after test rather than riding along.Suggested shape, if queued
Mirror #5587: drop both refs, depend on
fieldLabel/fieldOptionLabeldirectly in the effect's dep array, and pin it with a test that counts effect runs (orgetObjectSchemacalls) across re-renders both inside and outside a provider. #5587'sObjectChart.fieldOptionLabelRefetch.test.tsxis a usable template, including the ordering note aboutcreateI18nregistering a process-global instance.Worth checking as part of that work whether the two derived state maps (
setFieldLabelMaps/setFieldNameLabels) can settle, since a direct dependency puts them in a loop's path the same wayfetchDatawas in #5587's.Related: #5587, #5564, #5585.