Delete savepoints when deleting blank forms they belong to #6139
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.
Closes #6131
Why is this the best possible solution? Were any other approaches considered?
Removing savepoints when forms they belong to are being deleted seems to be the best solution that not only fixes the issue but also protects us from having orphaned savepoints. Another solution could be for example comparing dates of creation to avoid using savepoints that were created earlier than the form itself but those savepoints would still be present in the database and in the cache dir so I think getting rid of them is the proper approach.
I've implemented this only for blank forms as this turned out to be an issue but we should do the same for saved forms too in order to avoid keeping orphaned savepoints. I will file a separate issue for that.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
The main change is that during deleting blank forms their savepoints should also be deleted to avoid keeping orphaned savepoints. This will happen not only if a blank form is completely deleted but also in the case of soft deletion. Thanks to that issue #6131 will be fixed.
So far it didn't work like that so if a blank form was deleted but had a savepoint that savepoint remained in the database and in the cache dir (savepoints were only removed when igorered in the form view). Such a savepoint would be useless and would only clutter the cache dir. This is something we probably haven't tested that much so now it's a good time to do that.
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still pass