Skip to content

Commit

Permalink
fix(ui): dedupes custom id fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsfletch committed Nov 6, 2024
1 parent 8a5f6f0 commit c60f64c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type {
TabsFieldClient,
} from 'payload'

import { deepCopyObjectSimple, MissingEditorProp } from 'payload'
import { deepCopyObjectSimple, flattenTopLevelFields, MissingEditorProp } from 'payload'
import { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared'

import { getComponent } from './getComponent.js'
Expand Down Expand Up @@ -579,7 +579,7 @@ export const createClientFields = ({
}
}

const hasID = newClientFields.findIndex((f) => fieldAffectsData(f) && f.name === 'id') > -1
const hasID = flattenTopLevelFields(fields).some((f) => fieldAffectsData(f) && f.name === 'id')

if (!disableAddingID && !hasID) {
newClientFields.push({
Expand Down

0 comments on commit c60f64c

Please sign in to comment.