Commit d34664d
committed
fix(workflow): preserve parent and position when duplicating/pasting nested blocks
Three related fixes for blocks inside containers (loop/parallel):
1. regenerateBlockIds now preserves parentId when the parent exists in
the current workflow, not just when it's in the copy set. This keeps
duplicated blocks inside their container.
2. calculatePasteOffset now uses simple offset for nested blocks instead
of viewport-center calculation. Since nested blocks use relative
positioning, the viewport-center offset would place them incorrectly.
3. Use CONTAINER_DIMENSIONS constants instead of hardcoded magic numbers
in orphan cleanup position calculation.1 parent 503f676 commit d34664d
File tree
2 files changed
+29
-6
lines changed- apps/sim
- app/workspace/[workspaceId]/w/[workflowId]
- stores/workflows/workflow
2 files changed
+29
-6
lines changedLines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
107 | 115 | | |
108 | | - | |
| 116 | + | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
| |||
1024 | 1038 | | |
1025 | 1039 | | |
1026 | 1040 | | |
1027 | | - | |
| 1041 | + | |
1028 | 1042 | | |
1029 | 1043 | | |
1030 | 1044 | | |
| |||
1036 | 1050 | | |
1037 | 1051 | | |
1038 | 1052 | | |
| 1053 | + | |
1039 | 1054 | | |
1040 | 1055 | | |
1041 | 1056 | | |
| |||
1146 | 1161 | | |
1147 | 1162 | | |
1148 | 1163 | | |
1149 | | - | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1150 | 1168 | | |
1151 | 1169 | | |
1152 | 1170 | | |
| |||
1168 | 1186 | | |
1169 | 1187 | | |
1170 | 1188 | | |
| 1189 | + | |
1171 | 1190 | | |
1172 | 1191 | | |
1173 | 1192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
446 | 447 | | |
447 | 448 | | |
448 | 449 | | |
449 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
| |||
0 commit comments