Closed
Description
React version: Any
React Developer Tools: 4.8.2
Steps To Reproduce
- create and render a Component which contains infinite iterator
function* makeCounter() {
let c = 0;
while (true) {
yield c++;
}
}
const counter = makeCounter();
const Sample = () => <Component counter={counter} />;
-
open chrome devtools and select this component with React Dev Tools (Components tab)
-
crashes after few seconds
Link to code example:
https://codesandbox.io/s/happy-lake-c1vyf?file=/src/App.js
The current behavior
The page crashes due to devtools crash.
The expected behavior
devtools doesn't crash.
This is because ReactDevTools is trying to display elements inside iterator object with transforming it into array here:
Iterators could be generally infinite (and also have side effect, like counter in the example). So I think it should not be extracted to array here.