File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
services/static-webserver/client/source/class/osparc/data/model Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -896,15 +896,23 @@ qx.Class.define("osparc.data.model.Workbench", {
896896 // not solved yet, reload the site to avoid issues
897897 window . location . reload ( ) ;
898898
899- // this is an async operation with an await
900899 const promises = nodesAdded . map ( nodeId => {
901- const nodeData = workbenchPatchesByNode [ nodeId ] [ 0 ] . value ;
900+ const addNodePatch = workbenchPatchesByNode [ nodeId ] . find ( workbenchPatch => {
901+ const pathParts = workbenchPatch . path . split ( "/" ) ;
902+ return pathParts . length === 3 && workbenchPatch . op === "add" ;
903+ } ) ;
904+ const nodeData = addNodePatch . value ;
905+ // delete the node "add" from the workbenchPatchesByNode
906+ const index = workbenchPatchesByNode [ nodeId ] . indexOf ( addNodePatch ) ;
907+ if ( index > - 1 ) {
908+ workbenchPatchesByNode [ nodeId ] . splice ( index , 1 ) ;
909+ }
910+ // this is an async operation with an await
902911 return this . createNode ( nodeData [ "key" ] , nodeData [ "version" ] ) ;
903912 } ) ;
904913 return Promise . all ( promises )
905914 . then ( nodes => {
906915 // may populate it
907- // OM? delete the node add from the workbenchPatchesByNode
908916 // after adding nodes, we can apply the patches
909917 this . __updateNodesFromPatches ( workbenchPatchesByNode ) ;
910918 } )
You can’t perform that action at this time.
0 commit comments