()
| 73 | }); |
| 74 | |
| 75 | const apply = async () => { |
| 76 | onApply( |
| 77 | lastSelectedVariableNodeId.current && |
| 78 | getVariablePathFromNodeId( |
| 79 | lastSelectedVariableNodeId.current, |
| 80 | groupVariablesContainer |
| 81 | ) |
| 82 | ); |
| 83 | if (!initialInstances) { |
| 84 | // This can only happens for legacy function object groups. |
| 85 | // In this case, we don't do any refactoring. |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | const originalSerializedVariables = getOriginalVariablesSerializedElement(); |
| 90 | const changeset = gd.WholeProjectRefactorer.computeChangesetForVariablesContainer( |
| 91 | originalSerializedVariables, |
| 92 | groupVariablesContainer |
| 93 | ); |
| 94 | |
| 95 | gd.WholeProjectRefactorer.applyRefactoringForGroupVariablesContainer( |
| 96 | project, |
| 97 | globalObjectsContainer || objectsContainer, |
| 98 | objectsContainer, |
| 99 | initialInstances, |
| 100 | groupVariablesContainer, |
| 101 | objectGroup, |
| 102 | changeset, |
| 103 | originalSerializedVariables |
| 104 | ); |
| 105 | const { eventsBasedObject } = projectScopedContainersAccessor.getScope(); |
| 106 | if (eventsBasedObject) { |
| 107 | for (const objectName of objectGroup.getAllObjectsNames().toJSArray()) { |
| 108 | gd.ObjectRefactorer.applyChangesToVariants( |
| 109 | eventsBasedObject, |
| 110 | objectName, |
| 111 | changeset |
| 112 | ); |
| 113 | } |
| 114 | } |
| 115 | groupVariablesContainer.clearPersistentUuid(); |
| 116 | }; |
| 117 | |
| 118 | const lastSelectedVariableNodeId = React.useRef<string | null>(null); |
| 119 | const onSelectedVariableChange = React.useCallback((nodes: Array<string>) => { |
nothing calls this directly
no test coverage detected