WebStorm Gets Stuck In An Infinite Loop Generating Import Statements (Merge Imports For Members From The Same Module option unchecked)
I assume this is TypeScript specific.
If I have the option “Merge Imports For Members From The Same Module” unchecked (because I want all imports on individual lines regardless of the module).
And if there is any kind of an error (could be just a modified prop) within the implementation code for an imported component (within that same tsx file with the import statement).
WebStorm gets stuck in an infinite import loop generating import statements for that component with the error.
The only way to stop this infinite import loop is to comment out the component with the error.
Following that you obviously need to remove all duplicated import statements, fix the error while the component remains commented out (or the infinite import loop will restart), and then comment the changes back in.
This does not happen if “Merge Imports For Members From The Same Module” is checked.
Please sign in to leave a comment.
Unfortunately, it’s not quite clear what the problem is. Can you please describe it in more detail? Does it happen on choosing a component from completion, on optimizing imports, or? Could you please share a video recording of the problem with us? This will help us to understand what it looks like on your side.
Here’s an example video.
https://www.dropbox.com/scl/fo/p7scfl08eezw2etiqvbn4/AG-Zw70J18RDN6QWoq5IHDA?rlkey=jasj5ch4mds159buzf4lm1zjk&dl=0
I was refactoring and cleaning up this messy component.
props.model.vesselIds no longer exists. This property is referred to from RowDetailWidget that has been imported into this component.
If I simply enter a new line (i.e. hit return on the keyboard) after the existing import statements, you can see how WebStorm starts to import duplicates of RowDetailWidget.
This will continue like this until I scroll down and simply click elsewhere in the code. When I scroll back up, you can see the imports have stopped (from me just clicking elsewhere in the file). Then when I simply click under those import statements, it starts to import duplicates of RowDetailWidget again.
This is not isolated to this particular component. It happens everywhere in the project when there is an error (missing prop, renamed prop, new required prop) within an imported component like this.
As mentioned, this appears to not happen when “Merge Imports For Members From The Same Module” is checked.
This import process can only be stopped if I very quickly go to the original RowDetailWidget import statement, comment that out, and then quickly try to delete the duplicate imports as they are still generating.
Sometimes the importing happens so rapidly that all I can do is quit WebStorm and then discard any changes made to that file outside of WebStorm, and try to do it somehow differently.
Let me know if you need more information. Thanks!
-
WebStorm 2024.1.5
Build #WS-241.18034.50, built on June 19, 2024
Runtime version: 17.0.11+1-b1207.24 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.7.4
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 20
Metal Rendering is ON
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Non-Bundled Plugins:
com.vermouthx.xcode-theme (1.7.0)
com.intellij.plugins.xcodekeymap (241.14494.150)
com.jetbrains.space (241.18034.4)
com.intellij.ml.llm (241.18034.12)
com.intellij.lang.jsgraphql (241.14494.150)
com.haulmont.rcb (241.14494.140)
It does seem similar, yes. The issue you provided the link to appears stale (it was posted 5 months ago). Is this being worked on?
We’re working to get this fixed. Please monitor the issue for updates.
Thank you! Appreciate the effort. Great piece of software and this is the only issue I’ve personally run into.