IDEA-349993 [ExternalSystem|Recovery] fix: invalidate workspace caches together with the JPS external storage

The workspace model and JPS synchroniser can try to load the partially invalidated project structure. It causes unexpected fluctuations in project view and their structure.

Therefore, we need to invalidate both storages in one recovery action.

GitOrigin-RevId: 279b30ca9b744cbecc1e116b1339d7e68e94dff3
This commit is contained in:
Sergei Vorobyov
2024-05-22 17:54:38 +02:00
committed by intellij-monorepo-bot
parent ef7f5c7b40
commit 85efa4304f

View File

@@ -19,6 +19,7 @@ import com.intellij.openapi.util.io.NioFiles
import com.intellij.platform.backend.workspace.workspaceModel
import com.intellij.platform.workspace.storage.entities
import com.intellij.util.application
import com.intellij.workspaceModel.ide.impl.WorkspaceModelCacheImpl
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
@@ -54,6 +55,7 @@ class ExternalProjectsDataRecoveryAction : RecoveryAction {
invalidateProjectBuildClasspathCache(recoveryScope)
invalidateExternalSystemDataStorage(recoveryScope)
invalidateExternalSystemToolwindow(recoveryScope)
WorkspaceModelCacheImpl.invalidateCaches()
val externalSystemCache = ExternalProjectsDataStorage.getProjectConfigurationDir(recoveryScope.project)