This commit is contained in:
2025-10-29 20:21:45 +01:00
parent d5e2e1559d
commit 28868c24ca
2 changed files with 255 additions and 59 deletions

View File

@@ -89,6 +89,9 @@ export function NodeCanvas({
// Update NPC config when nodes change
useEffect(() => {
// Skip if no nodes yet
if (nodes.length === 0) return;
const newConfig = { ...npcConfig };
nodes.forEach((node) => {
@@ -146,14 +149,16 @@ export function NodeCanvas({
}
});
// Update parent config
onConfigChange(newConfig);
// Update output node preview
// Update output node preview with the new config
// Check if output node exists and if its preview data needs updating
const outputNode = nodes.find(n => n.data.type === 'output');
if (outputNode) {
if (outputNode && JSON.stringify(outputNode.data.previewData) !== JSON.stringify(newConfig)) {
setNodes((nds) =>
nds.map((node) =>
node.id === outputNode.id
node.data.type === 'output'
? { ...node, data: { ...node.data, previewData: newConfig } }
: node
)