()
| 182 | props.editorComponent; |
| 183 | |
| 184 | const onApply = async () => { |
| 185 | props.onApply(hasResourceChanged, hasAnyEffectBeenAdded); |
| 186 | |
| 187 | const initialInstances = |
| 188 | (layout && layout.getInitialInstances()) || |
| 189 | (eventsBasedObject && eventsBasedObject.getInitialInstances()) || |
| 190 | null; |
| 191 | if (!initialInstances) { |
| 192 | // This can't actually happen. |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | const originalSerializedVariables = getOriginalContentSerializedElement().getChild( |
| 197 | 'variables' |
| 198 | ); |
| 199 | const changeset = gd.WholeProjectRefactorer.computeChangesetForVariablesContainer( |
| 200 | originalSerializedVariables, |
| 201 | object.getVariables() |
| 202 | ); |
| 203 | gd.WholeProjectRefactorer.applyRefactoringForObjectVariablesContainer( |
| 204 | project, |
| 205 | object.getVariables(), |
| 206 | initialInstances, |
| 207 | object.getName(), |
| 208 | changeset, |
| 209 | originalSerializedVariables |
| 210 | ); |
| 211 | if (eventsBasedObject) { |
| 212 | gd.ObjectRefactorer.applyChangesToVariants( |
| 213 | eventsBasedObject, |
| 214 | object.getName(), |
| 215 | changeset |
| 216 | ); |
| 217 | } |
| 218 | |
| 219 | // Clear variable UUIDs to avoid them being persisted in the project file. |
| 220 | object.getVariables().clearPersistentUuid(); |
| 221 | |
| 222 | // Do the renaming *after* applying changes, as "withSerializableObject" |
| 223 | // HOC will unserialize the object to apply modifications, which will |
| 224 | // override the name. |
| 225 | onRename(objectName); |
| 226 | }; |
| 227 | |
| 228 | const { DismissableTutorialMessage } = useDismissableTutorialMessage( |
| 229 | 'intro-variables' |
no test coverage detected