Skip to content

Commit

Permalink
added comment on why reset state only if res is modified (redhat-deve…
Browse files Browse the repository at this point in the history
…loper#634)

Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Jul 20, 2023
1 parent 405ace7 commit 97924f2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ open class EditorResource(
* @see [areEqual]
* @see [isSameResource]
* @see [setState]
* @see [getState]
*/
fun setResource(new: HasMetadata) {
resourceChangeMutex.withLock {
val existing = this.resource
if (new.isSameResource(existing)
&& !areEqual(new, existing)) {
this.resource = new
setState(null) // reset state
/**
* only reset state if resource is modified
* to preserve existing error, pushed/pulled state
*/
setState(null)
}
}
}
Expand Down

0 comments on commit 97924f2

Please sign in to comment.