fix: remove localized property from RowField and CollapsibleField (#9672)

### What?
Removes the `localized` property from typescript suggestion for row and
collapsible fields.

### Why?
Currently, this property doesn't do anything for them. This may be
changed when/if we support `name` for them, but it'll work only with
`name`.

Fixes https://github.com/payloadcms/payload/issues/4720
This commit is contained in:
Sasha
2024-12-16 16:57:21 +02:00
committed by GitHub
parent 00909ec5c4
commit c187bff581
3 changed files with 6 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ import { baseIDField } from '../baseFields/baseIDField.js'
import { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js'
import { validations } from '../validations.js'
import { sanitizeJoinField } from './sanitizeJoinField.js'
import { fieldAffectsData, tabHasName } from './types.js'
import { fieldAffectsData, fieldIsLocalized, tabHasName } from './types.js'
type Args = {
collectionConfig?: CollectionConfig
@@ -249,7 +249,7 @@ export const sanitizeFields = async ({
? `${joinPath ? joinPath + '.' : ''}${field.name}`
: joinPath,
joins,
parentIsLocalized: parentIsLocalized || field.localized,
parentIsLocalized: parentIsLocalized || fieldIsLocalized(field),
requireFieldLevelRichTextEditor,
richTextSanitizationPromises,
validRelationships,

View File

@@ -658,7 +658,7 @@ export type RowField = {
admin?: Omit<Admin, 'description'>
fields: Field[]
type: 'row'
} & Omit<FieldBase, 'admin' | 'label' | 'name' | 'validate' | 'virtual'>
} & Omit<FieldBase, 'admin' | 'label' | 'localized' | 'name' | 'validate' | 'virtual'>
export type RowFieldClient = {
admin?: Omit<AdminClient, 'description'>
@@ -697,7 +697,7 @@ export type CollapsibleField = {
label: Required<FieldBase['label']>
}
) &
Omit<FieldBase, 'label' | 'name' | 'validate' | 'virtual'>
Omit<FieldBase, 'label' | 'localized' | 'name' | 'validate' | 'virtual'>
export type CollapsibleFieldClient = {
admin?: {

View File

@@ -19,6 +19,7 @@ import {
fieldHasSubFields,
fieldIsHiddenOrDisabled,
fieldIsID,
fieldIsLocalized,
fieldIsSidebar,
getFieldPaths,
tabHasName,
@@ -626,7 +627,7 @@ export const addFieldStatePromise = async (args: AddFieldStatePromiseArgs): Prom
id,
// passthrough parent functionality
addErrorPathToParent: addErrorPathToParentArg,
anyParentLocalized: field.localized || anyParentLocalized,
anyParentLocalized: fieldIsLocalized(field) || anyParentLocalized,
clientFieldSchemaMap,
collectionSlug,
data,