It's kinda natural if it's a technology/language you don't fully understand (for instance, trying to refactor code that uses a library you don't know, unless you take your time and understand it, you'll probably leave/delete a line that will unleash havoc in your software).
One of my usual ways to refactor "on-the-go" is to completely extract a code block, using IDE or not, and as I test, refactor that code block. That way I usually avoid mistakes like that and also stay productive, since the tests itself usually help me understand the flow my code should have.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's kinda natural if it's a technology/language you don't fully understand (for instance, trying to refactor code that uses a library you don't know, unless you take your time and understand it, you'll probably leave/delete a line that will unleash havoc in your software).
One of my usual ways to refactor "on-the-go" is to completely extract a code block, using IDE or not, and as I test, refactor that code block. That way I usually avoid mistakes like that and also stay productive, since the tests itself usually help me understand the flow my code should have.