Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor crashes on syntax error in useEffect cleanup function #388

Open
2 tasks done
zheeeng opened this issue Mar 25, 2024 · 0 comments
Open
2 tasks done

Editor crashes on syntax error in useEffect cleanup function #388

zheeeng opened this issue Mar 25, 2024 · 0 comments

Comments

@zheeeng
Copy link

zheeeng commented Mar 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Code Sandbox link

No response

Bug report

Try the official demo, add useEffect and try modify its dispose code:

type Props = {
  label: string;
}
const Counter = (props: Props) => {
  const [count, setCount] =
    React.useState<number>(0)

  React.useEffect(
     () => {
        // Modify this line cause crash:
        return () => {aa
        }
     },
     [],
  )

  return (
    <div>
      <h3 style={{
        background: 'darkslateblue',
        color: 'white',
        padding: 8,
        borderRadius: 4
      }}>
        {props.label}: {count} 🧮
      </h3>
      <button
        onClick={() =>
          setCount(c => c + 1)
        }>
        Increment
      </button>
    </div>
  )
}
render(<Counter label="Counter" />)
@zheeeng zheeeng added the bug label Mar 25, 2024
@carbonrobot carbonrobot changed the title [Stable Peproduce] Editor Crash Editor crashes on syntax error in useEffect cleanup function Mar 25, 2024
@r281GQ r281GQ self-assigned this Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants