| 81 | }); |
| 82 | |
| 83 | const apply = async () => { |
| 84 | onApply(); |
| 85 | if (!initialInstances) { |
| 86 | // This can only happens for legacy function object groups. |
| 87 | // In this case, we don't do any refactoring. |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | const originalSerializedVariables = getOriginalVariablesSerializedElement(); |
| 92 | const changeset = gd.WholeProjectRefactorer.computeChangesetForVariablesContainer( |
| 93 | originalSerializedVariables, |
| 94 | groupVariablesContainer |
| 95 | ); |
| 96 | |
| 97 | gd.WholeProjectRefactorer.applyRefactoringForGroupVariablesContainer( |
| 98 | project, |
| 99 | globalObjectsContainer || objectsContainer, |
| 100 | objectsContainer, |
| 101 | initialInstances, |
| 102 | groupVariablesContainer, |
| 103 | group, |
| 104 | changeset, |
| 105 | originalSerializedVariables |
| 106 | ); |
| 107 | const { eventsBasedObject } = projectScopedContainersAccessor._scope; |
| 108 | if (eventsBasedObject) { |
| 109 | for (const objectName of group.getAllObjectsNames().toJSArray()) { |
| 110 | gd.ObjectRefactorer.applyChangesToVariants( |
| 111 | eventsBasedObject, |
| 112 | objectName, |
| 113 | changeset |
| 114 | ); |
| 115 | } |
| 116 | } |
| 117 | groupVariablesContainer.clearPersistentUuid(); |
| 118 | }; |
| 119 | |
| 120 | const removeObject = React.useCallback( |
| 121 | (objectName: string) => { |