fix: UUID handling - remove parseInt() for prompt IDs
Critical Bug Fixes:
1. Prompt IDs are UUIDs (strings), NOT numbers
2. parseInt(UUID) produces wrong results:
- parseInt("3b4d7d64-...") = 3 (truncates at first non-digit)
- parseInt("aa291dde-...") = NaN
3. This caused:
- Prompt selection: saved as NaN instead of UUID
- Load workflow: GET /api/prompts/3 instead of /api/prompts/3b4d7d64-...
- 405 Method Not Allowed errors
Changes:
- useEffect: loadWorkflow(id) instead of loadWorkflow(parseInt(id))
- Prompt onChange: prompt_id: promptId (string) instead of parseInt(promptId)
- Removed NaN check (unnecessary for UUID strings)
Root Cause: Backend uses UUID primary keys, frontend assumed integer IDs
Testing: Console logs still active for verification
This commit is contained in:
parent
2b8bebd381
commit
84c1fa3c1d
|
|
@ -62,11 +62,9 @@ export default function WorkflowEditorPage() {
|
||||||
|
|
||||||
// Load workflow wenn ID vorhanden
|
// Load workflow wenn ID vorhanden
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id && id !== 'new' && !isNaN(parseInt(id))) {
|
if (id && id !== 'new') {
|
||||||
console.log('🔍 useEffect: Loading workflow with ID:', id)
|
console.log('🔍 useEffect: Loading workflow with ID:', id)
|
||||||
loadWorkflow(parseInt(id))
|
loadWorkflow(id) // UUID as string, no parseInt!
|
||||||
} else if (id && id !== 'new') {
|
|
||||||
console.error('❌ useEffect: Invalid ID (NaN):', id)
|
|
||||||
}
|
}
|
||||||
}, [id])
|
}, [id])
|
||||||
|
|
||||||
|
|
@ -419,7 +417,7 @@ export default function WorkflowEditorPage() {
|
||||||
const selectedPrompt = availablePrompts.find(p => String(p.id) === promptId)
|
const selectedPrompt = availablePrompts.find(p => String(p.id) === promptId)
|
||||||
console.log('📋 Selected prompt object:', selectedPrompt)
|
console.log('📋 Selected prompt object:', selectedPrompt)
|
||||||
handleNodeUpdate(selectedNode.id, {
|
handleNodeUpdate(selectedNode.id, {
|
||||||
prompt_id: promptId ? parseInt(promptId) : null,
|
prompt_id: promptId || null, // UUID as string, no parseInt!
|
||||||
prompt_name: selectedPrompt?.name || null
|
prompt_name: selectedPrompt?.name || null
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user