buildFormState with select evaluates admin.condition against data with unselected fields already deleted
Los mantenedores suelen responder en 1 día
@hassanabrar202 ya está trabajando en esto.
Desde el 15/11/2026.
- #19605 de @hassanabrar202 — abierto
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 40/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Start at forms/fieldSchemasToFormState/calculateDefaultValues/promise.ts where stripUnselectedFields deletes unselected keys, then read fieldSchemasToFormState/index.tsx to see how fullData is assigned and how iterateFields supplies sibling data to admin.condition. Reproduce by running the linked tests/int/selectCondition.int.spec.ts against the reported repro, covering both the top-level extra case and the nested address.city case. Done means conditions see the pre-strip copy while the returned state is still limited to select. Note a linked pull request (#19605) is already open, so coordinate before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
In 4.0.0-beta.9, a form state request with select checks each field's admin.condition against data that is already missing every unselected field. Any field whose condition reads a field outside select comes back with passesCondition: false, so it disappears from the form. A form that edits one field of a document (<Form select={{ extra: true }}>) therefore loses that field as soon as its condition depends on another field.
Cause: with select, stripUnselectedFields deletes unselected keys from the data object, first in calculateDefaultValues (forms/fieldSchemasToFormState/calculateDefaultValues/promise.ts) and again in iterateFields. That same object is what admin.condition later receives. At the top level it is both data and fullData (fieldSchemasToFormState/index.tsx: let fullData = dataWithDefaultValues), and for a group it is the group's sibling data.
A fix that makes the repro pass: take a copy of data before stripping when select is set (structuredClone(data)), use it as fullData, and in iterateFields pass the matching sibling object from that copy (looked up by parentPath) as the condition's siblingData. The returned state stays limited to select.
Link to the code that reproduces this issue
https://github.com/cgilly2fast/payload-select-condition-repro
Reproduction Steps
pnpm install && cp .env.example .envpnpm test:int tests/int/selectCondition.int.spec.ts
src/collections/Posts.ts has extra, shown only when title is set, and address.city, shown only when its sibling address.country is US. The test builds form state for a post with title: 'Hello' and address.country: 'US':
- No
select(control): both fields pass their conditions. select: { extra: true }:extragetspassesCondition: false. Expected: it passes, becausetitleis set.select: { address: { city: true } }:address.citygetspassesCondition: false. Expected: it passes, becausecountryisUS.
Which area(s) are affected?
area: ui
Environment Info
payload 4.0.0-beta.9, @payloadcms/ui 4.0.0-beta.9, @payloadcms/db-sqlite 4.0.0-beta.9, Node 24, created with create-payload-app@beta -t blank.
- Lenguaje dominante
- TypeScript
- Estrellas
- 45.8k
- Forks
- 4.4k
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 251
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de payloadcms/payload
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPosiblemente ocupada @pcbeingused333 la tomó hoy. AbiertoBug db: d1-sqlite Payload OSS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#19766 ·
Los mantenedores suelen responder en 1 día
-
Document bar (.doc-controls__content) overflows a 375 px viewport, clips "Created" and fails axe scrollable-region-focusablePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea: ui Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
payloadcms/payload#19690 ·
Los mantenedores suelen responder en 1 día
-
[v4] Blocks thumbnails croped 3:2Posiblemente ocupada @samiarif02 la tomó hace 2 días. Abiertoarea: ui Bug Payload OSS status: needs-triage v3
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
payloadcms/payload#19609 ·
Los mantenedores suelen responder en 1 día
-
Scheduled publish jobs are not deleted when their document is deleted (string id in the job, raw id in the cleanup)Posiblemente ocupada @volodymyrshk la tomó hace 10 días. Abiertoarea: core Bug db: sqlite
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#19448 ·
Los mantenedores suelen responder en 1 día
-
plugin-multi-tenant: `isGlobal` collections redirect tenant-scoped users to `/admin` since 3.93.0 (GlobalViewRedirect prop-name mismatch)Posiblemente ocupada @JarrodMFlesch la tomó hace 10 días. AbiertoBug plugin: multi-tenant
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#19420 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de payloadcms/payload
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
milind-soni/OpenMausBot#6730 ·
Los mantenedores suelen responder en 1 día
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Abiertoarea: @angular/build
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
angular/angular-cli#34764 ·
Los mantenedores suelen responder en 1 día
-
status/need-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
google-gemini/gemini-cli#30384 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
P2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
area:image documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día