Skip to content

Commit 71cc8be

Browse files
committed
java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only
1 parent a7ea8e6 commit 71cc8be

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/com/intellij/lang/jsgraphql/ide/project/GraphQLUIProjectService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import com.intellij.lang.jsgraphql.ide.actions.GraphQLEditConfigAction;
2121
import com.intellij.lang.jsgraphql.ide.actions.GraphQLExecuteEditorAction;
2222
import com.intellij.lang.jsgraphql.ide.actions.GraphQLToggleVariablesAction;
23-
import com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionService;
2423
import com.intellij.lang.jsgraphql.ide.highlighting.query.GraphQLQueryContext;
2524
import com.intellij.lang.jsgraphql.ide.highlighting.query.GraphQLQueryContextHighlightVisitor;
25+
import com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionService;
2626
import com.intellij.lang.jsgraphql.ide.notifications.GraphQLNotificationUtil;
2727
import com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigManager;
2828
import com.intellij.lang.jsgraphql.ide.project.graphqlconfig.GraphQLConfigurationListener;
@@ -170,9 +170,12 @@ private void reloadEndpoints() {
170170
if (myProject.isDisposed()) return;
171171
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
172172
final GraphQLConfigManager graphQLConfigManager = GraphQLConfigManager.getService(myProject);
173-
List<VirtualFile> files = Arrays.stream(fileEditorManager.getOpenFiles())
174-
.filter(f -> GraphQLFileType.isGraphQLFile(myProject, f))
175-
.collect(Collectors.toList());
173+
List<VirtualFile> files = ReadAction.compute(
174+
() -> Arrays.stream(fileEditorManager.getOpenFiles())
175+
.filter(f -> GraphQLFileType.isGraphQLFile(myProject, f))
176+
.collect(Collectors.toList())
177+
);
178+
if (myProject.isDisposed()) return;
176179

177180
for (VirtualFile file : files) {
178181
List<GraphQLConfigEndpoint> endpoints =

0 commit comments

Comments
 (0)