Skip to content

Commit 991e10f

Browse files
committed
added comment on why reset state only if res is modified (#634)
Signed-off-by: Andre Dietisheim <[email protected]>
1 parent 405ace7 commit 991e10f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/main/kotlin/com/redhat/devtools/intellij/kubernetes/editor/EditorResource.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ open class EditorResource(
5757
* @see [areEqual]
5858
* @see [isSameResource]
5959
* @see [setState]
60+
* @see [getState]
6061
*/
6162
fun setResource(new: HasMetadata) {
6263
resourceChangeMutex.withLock {
6364
val existing = this.resource
6465
if (new.isSameResource(existing)
6566
&& !areEqual(new, existing)) {
6667
this.resource = new
67-
setState(null) // reset state
68+
/**
69+
* only reset state if resource is modified
70+
* to preserve existing error, pushed/pulled state
71+
*/
72+
setState(null)
6873
}
6974
}
7075
}

0 commit comments

Comments
 (0)