fix(ui): client side error when passing labels as functions for custom view tabs (#8339)
This commit is contained in:
@@ -250,6 +250,15 @@ export const createClientCollectionConfig = ({
|
||||
)
|
||||
}
|
||||
|
||||
// Ensure that the label in Edit view is a string, translate it if it's a function
|
||||
if (collection?.admin?.components?.views?.edit) {
|
||||
Object.entries(collection?.admin?.components?.views?.edit).forEach(([key, view]) => {
|
||||
if ('tab' in view && 'label' in view.tab && typeof view.tab.label === 'function') {
|
||||
collection.admin.components.views.edit[key].tab.label = view.tab.label({ t: i18n.t })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
clientCollection.admin.components.views = (
|
||||
collection?.admin?.components?.views
|
||||
? deepCopyObjectSimple(collection?.admin?.components?.views)
|
||||
|
||||
Reference in New Issue
Block a user