sandpack
sandpack copied to clipboard
Editor hangs when useEffect has no dependency specifed
Bug report
Packages affected
- [ ] sandpack-client
- [x] sandpack-react
Description of the problem
Unable to type in editor when useEffect has no dependency specified.
Code used in the editor.
import React, { useEffect, useState } from "react";
const App = () => {
const [count, setCount] = useState(0);
useEffect(() => {
setCount((count) => count + 1);
});
return (
<div>Test</div>
)
};
export default App;
What were you doing when the problem occurred?
Trying to type in the sandpack editor.
What steps can we take to reproduce the problem?
Code used for setup.
import React from "react";
import { Sandpack } from "@codesandbox/sandpack-react";
const App = () => {
const files = {}
return (
<Sandpack
files={files}
theme="light"
template="react"
options={{
showConsoleButton: true,
showInlineErrors: true,
showNavigator: true,
showLineNumbers: true,
showTabs: true,
}}
/>
)
}
export default App;
Attached screen recording
https://github.com/codesandbox/sandpack/assets/60211909/97fe1679-e708-48f3-8df0-2cd25e199ba2
Link to sandbox: link (optional)
Your Environment
| Software | Name/Version |
|---|---|
| Sandpack-client version | |
| Sandpack-react version | 2.10.0 |
| Browser | Chrome |
| Operating System | Mac |