bug(revit): CNX-8730 deletes existing objects in a subtransaction during receive #3209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description & motivation
When receiving in Revit in update mode, always deletes existing objects in a subtransaction. This fixes a bug where in certain conditions, attempts to delete existing objects are made without any active transaction.
This bug turned out to be completely unrelated to Sketchup direct shape mappings, but direct shapes are one of few objects that are properly "updated" (an existing direct shape object's shape is modified in update mode, vs the existing object being deleted and a new ds being created).
The following reproduction steps create the "failed update" behavior:
While my changes appear to fix the failed updating behavior described above, I'd like @connorivy to take a look at the proposed changes because it's still unclear to me why no active transaction existed (my guess is that passing the transaction manager to the converter, editing the direct shape in the converter closed the transaction, and therefore no open transaction was available when the connector attempts to delete the existing object ). There may be a more robust way to handle transactions due to the differences in direct shape editing in the converter compared to most other conversion routines.
To-do before merge: