mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 00:43:23 +00:00
Fix duplicate field name issue by prefixing custom trigger fields
- Prefix custom trigger field names with trigger slug to avoid conflicts - Built-in fields use __builtin_ prefix - Custom trigger fields use __<triggerSlug>_ prefix - Prevents naming collisions between different trigger types
This commit is contained in:
@@ -298,6 +298,8 @@ export const createWorkflowCollection: <T extends string>(options: WorkflowsPlug
|
|||||||
// Virtual fields for custom triggers
|
// Virtual fields for custom triggers
|
||||||
...(triggers || []).flatMap(t => (t.inputs || []).filter(f => 'name' in f && f.name).map(f => ({
|
...(triggers || []).flatMap(t => (t.inputs || []).filter(f => 'name' in f && f.name).map(f => ({
|
||||||
...f,
|
...f,
|
||||||
|
// Prefix field name with trigger slug to avoid conflicts
|
||||||
|
name: `__${t.slug}_${(f as any).name}`,
|
||||||
admin: {
|
admin: {
|
||||||
...(f.admin || {}),
|
...(f.admin || {}),
|
||||||
condition: (...args) => args[1]?.type === t.slug && (
|
condition: (...args) => args[1]?.type === t.slug && (
|
||||||
|
|||||||
Reference in New Issue
Block a user