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

Proposing we not reload when the dev mode websocket is unavailable #1500

Closed
johnnysprinkles opened this issue May 20, 2021 · 5 comments
Closed

Comments

@johnnysprinkles
Copy link
Contributor

johnnysprinkles commented May 20, 2021

Is your feature request related to a problem? Please describe.

There are a number ways the dev mode websocket on port 24678 can get broken. When you're running through various layers of proxy for SSL termination and authentication, and dealing with machines on different network fabrics, it's quite possible to just not have that working for whatever reason. In my case, our dev workstations are only reachable from our laptops via this crazy proxy and Chrome extension, and I was able to get the websocket working with the right SSH tunnel setup but I can certainly imagine others not being able to.

If you can't get the socket, falling back to just manual reload seems a lot better and more graceful then an infinite reload loop as we currently do.

I thought I could simply disable HMR with kit.vite.server.hmr = false in svelte.config.js but that didn't seem to do anything. But ideally you could leave it enabled, then if it can find its socket you get HMR otherwise you get Ctrl-R.

Describe the solution you'd like

I'd just like to disable the reload feature upon websocket failure. If it didn't work the first time, it's not going to work the second time. The auto reload isn't helping anybody.

Describe alternatives you've considered

If I knew the right way to disable HMR that would be helpful, but I'd still be in favor of this proposal.

How important is this feature to you?

Medium.

@johnnysprinkles
Copy link
Contributor Author

I'd be happy to send a pull request of course.

@JBusillo
Copy link
Contributor

JBusillo commented May 20, 2021

The retry logic is within Vite's client code, which incessantly tries to connect to the server's web socket when there's a connection failure. SvelteKit doesn't have control over this behavior.

There isn't any code in the Vite client code that accesses the server.hmr : false option.

There's an existing open issue: #844, which addresses the constant reloading when using a self-signed certificate.

@johnnysprinkles
Copy link
Contributor Author

Ah, I should have searched for an existing issue. Got more issues coming, I'll be sure to do that in the future.

Looks like #844 has all the relevant discussion, should I go ahead and close this as a dupe of that one?

@JBusillo
Copy link
Contributor

I'm not a maintainer, but, yes, I think you should close this issue. #844 addresses the SvelteKit side of this issue. And, it's been classified as a "Milestone 1.0", so the issue should be resolved once the official 1.0 version is released.

@johnnysprinkles
Copy link
Contributor Author

Duplicate of #844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants