Is there a way to disable component recycling?
See original GitHub issueIn my application, I’m using xterm, and I’m mounting it to a referred component on the componentDidMount
event.
The application can handle several tabs that are looped through .map
, and when a tab closes preact tries to reuse the <Terminal />
component, which looks all the same to him(since he just diffs the JSX part without the terminal element I believe, correct me if I’m wrong).
The problem is that every terminal is linked to a shell, and when it tries to reuse the terminal component it reuses the shell too, so closing a tab will then mess up all the related terminals and shells.
My code is public on GitHub if you want to read it or give it a try feel free to do it.
A critical part of it could be the willReciveProps
event that I’m using to prevent from re-rendering when cols, rows and selection of the terminal updates.
Here are the pieces of code:
<Terminal />
<Terminals />
(loop)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top GitHub Comments
@LucaT1 How did you solve it? By passing the
key
prop when instantiating<Terminal />
components?Yeah in fact it worked. Tough i may have named the issue wrongly