Skip to content

fix: SnykCode root nodes update after scan finished [ROAD-439] #196

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

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
implementation("com.google.code.gson:gson:2.8.6")
implementation("com.segment.analytics.java:analytics:3.1.0")
implementation("io.sentry:sentry:5.1.2")
implementation("io.snyk.code.sdk:snyk-code-client:2.1.11")
implementation("io.snyk.code.sdk:snyk-code-client:2.1.12")
implementation("ly.iterative.itly:plugin-iteratively:1.2.7")
implementation("ly.iterative.itly:plugin-schema-validator:1.2.7") {
exclude(group = "org.slf4j")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,10 @@ class SnykToolWindowPanel(val project: Project) : JPanel(), Disposable {
private fun displaySnykCodeResults(snykCodeResults: SnykCodeResults?) {
if (currentSnykCodeError != null) return
if (snykCodeResults == null) {
ApplicationManager.getApplication().invokeLater {
updateTreeRootNodesPresentation(
securityIssuesCount = -1,
qualityIssuesCount = -1
)
}
updateTreeRootNodesPresentation(
securityIssuesCount = -1,
qualityIssuesCount = -1
)
return
}
val selectedNodeUserObject = TreeUtil.findObjectInPath(vulnerabilitiesTree.selectionPath, Any::class.java)
Expand All @@ -622,12 +620,10 @@ class SnykToolWindowPanel(val project: Project) : JPanel(), Disposable {
}
displayResultsForRoot(rootSecurityIssuesTreeNode, securityResultsToDisplay)
}
ApplicationManager.getApplication().invokeLater {
updateTreeRootNodesPresentation(
securityIssuesCount = securityIssuesCount,
addHMLPostfix = securityIssuesHMLPostfix
)
}
updateTreeRootNodesPresentation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share why ApplicationManager.getApplication().invokeLater removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already inside EDT (fun caller is under invokeLater) so no real need to wrap it here again.
It was putted there by wrong assumption and later left as workaround to create artificial delay to let "right" thread win in race condition. :)

securityIssuesCount = securityIssuesCount,
addHMLPostfix = securityIssuesHMLPostfix
)
smartReloadRootNode(rootSecurityIssuesTreeNode, userObjectsForExpandedSecurityNodes, selectedNodeUserObject)

// display Quality (non Security) issues
Expand All @@ -648,12 +644,10 @@ class SnykToolWindowPanel(val project: Project) : JPanel(), Disposable {
}
displayResultsForRoot(rootQualityIssuesTreeNode, qualityResultsToDisplay)
}
ApplicationManager.getApplication().invokeLater {
updateTreeRootNodesPresentation(
qualityIssuesCount = qualityIssuesCount,
addHMLPostfix = qualityIssuesHMLPostfix
)
}
updateTreeRootNodesPresentation(
qualityIssuesCount = qualityIssuesCount,
addHMLPostfix = qualityIssuesHMLPostfix
)
smartReloadRootNode(rootQualityIssuesTreeNode, userObjectsForExpandedQualityNodes, selectedNodeUserObject)
}

Expand Down