Stop Focusing on Repl Console During Server Restart

A common issue I have is trying to make changes to a web project and while I’m making the changes and error will occur, causing my HMR server to crash and restart in a loop.

This was “solved” by Replit adding crash-loop protection on webservers but the experience in the IDE is still highly degrading because the cursor automatically focuses on the console as the Repl restarts. This is “intended behavior” when restarting a server once - but in a crash loop it makes it harder to fix a problem.

I would like to propose the change to not remove or change focus of the cursor while it is focused on the editor, regardless of what action is occurring in the IDE. This isn’t really a fleshed out idea and might have other repercussions so let’s throw it around and refine it, but its a compromise from just flat out disabling server restarting via requests.

5 Likes

I’m not involved in the engineering side here but just wanted to get more details. Do you have an example Repl that you can share that does this? (might be tricky I realise)

3 Likes

I think any Repl that uses HMR (so like Vite, a Next.js Repl, Astro, anything really you can find it in https://replit.com/templates (: ).

1 Like

A solution could be only focusing the console when the server starts but only when the user pressed the Run button, so if the server is in a crash loop and it keeps restarting automatically the console doesn’t get focused. This could also be a setting.

1 Like

Yes, this is quite annoying. I’m trying to develop a Node.js server and it is frustrating to have replit hide any errors I get and auto-restart before I can read them.

1 Like

Might be a little bit of a Necro, but I definitely agree with this, and this also heavily affects mobile re-focusing the webview as well.

1 Like

On this note, this is one of a few reasons why my server runs nodemon.

1 Like

What are the other reasons?

1 Like

I would prefer the server auto-restart in most cases1, I can specify what file edits will cause a reboot2, and also I like configuring things myself. :stuck_out_tongue:

Notes:

  1. When server crashes, nodemon stays running, so the repl does not entirely reboot, so the console is not cleared.
  2. I didn’t word this well, I can specify which files (when I edit them) will cause a reboot.
1 Like

Those make sense! So basically, you just don’t like how replit takes over and doesn’t let users have control over important things?

1 Like