-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix repeat deletion Issue by implementing Clear volatiles for tree element #1417
Conversation
I think we should be moving the logic for dispatching the volatile clearing from the DataInstance into each implementation of the method, where each implementation is required to both clear its own volatile state and dispatch the clear call to its children and other methods. There are two big reasons why. I checked, and I don't think this will actually create meaningfully more repetitive implementations. The only thing this change makes a little confusing is that I think the default implementation of clearCache should definitely call getBase().clearVolatiles(), so we either need a second implementation of cleanCache that gives it a different target, or we should just take the hit and clear all of the caches |
src/main/java/org/commcare/cases/instance/StorageBackedChildElement.java
Outdated
Show resolved
Hide resolved
aba181b
to
6173371
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me after the revisions! Thanks for getting this implemented across the models.
public void cleanCache() { | ||
referenceCache.clear(); | ||
getBase().clearVolatiles(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, this cleanCache
function is already being called in the correct way and we're just adding more cleanup code. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, for this particular use case of deleting repeat it gets called here
Technical Summary
https://dimagi.atlassian.net/browse/USH-4708 (Deleting a repeat was causing errors in resolving references for remaining repeat nodes)
After deleting a repeat, a node's reference can change due to change in repeat index of the node. Therefore we need to expire the existing cached references for TreeElements.
Safety Assurance
Safety story
Automated test coverage
Added in the PR plus in dimagi/formplayer#1597
QA Plan
None
Special deploy instructions
Rollback instructions
Review
Duplicate PR
Automatically duplicate this PR as defined in contributing.md.