@topconsultnpm/sdkui-react 6.21.0-dev1.17 → 6.21.0-dev1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -341,6 +341,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
341
341
  const isUndoingRedoing = useRef(false);
342
342
  const initialDiagramRef = useRef(null);
343
343
  const notifiedXmlRef = useRef(null);
344
+ const serializationGenRef = useRef(0);
344
345
  const svgRef = useRef(null);
345
346
  const containerRef = useRef(null);
346
347
  const [isDrawingConnection, setIsDrawingConnection] = useState(false);
@@ -430,10 +431,15 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
430
431
  setHistoryIndex(newHistory.length);
431
432
  }
432
433
  setWfDiagram(newDiagram);
434
+ const currentGen = ++serializationGenRef.current;
433
435
  (async () => {
434
436
  try {
435
437
  // await è necessario per attendere il risultato stringa
436
438
  const newXml = await serializeWfDiagramToXml(newDiagram);
439
+ // Ignora serializzazioni obsolete: se nel frattempo è partita una nuova serializzazione,
440
+ // questa è vecchia e non deve sovrascrivere il risultato più recente.
441
+ if (currentGen !== serializationGenRef.current)
442
+ return;
437
443
  notifiedXmlRef.current = newXml;
438
444
  // Chiama il callback per notificare TMWFEditor
439
445
  // L'invio dell'XML al genitore avviene solo a serializzazione completata.
@@ -449,7 +455,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
449
455
  catch (e) {
450
456
  TMExceptionBoxManager.show({ exception: e });
451
457
  }
452
- }, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
458
+ }, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly, onDiagramChange]);
453
459
  const handleUndo = useCallback(() => {
454
460
  if (isReadOnly)
455
461
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev1.17",
3
+ "version": "6.21.0-dev1.18",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",