Skip to content

Commit 35ca98e

Browse files
authored
fix: version view breaks when tab field has function for label (#13415)
### What? Fixes an issue where using a function as the `label` for a `tabs` field causes the versions UI to break. ### Why? The versions UI was not properly resolving function labels on `tab` fields, leading to a crash when trying to render them. ### How? Tweaked the logic so that if the label is a function, it gets called before rendering. Fixes #13375
1 parent 255bba9 commit 35ca98e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/next/src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ const buildVersionField = ({
329329
versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,
330330
versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo,
331331
}).versionFields,
332-
label: tab.label,
332+
label: typeof tab.label === 'function' ? tab.label({ i18n, t: i18n.t }) : tab.label,
333333
}
334334
if (tabVersion?.fields?.length) {
335335
baseVersionField.tabs.push(tabVersion)

0 commit comments

Comments
 (0)