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

chore(vite): Hide API proxy error on start #8705

Merged
merged 8 commits into from
Jun 27, 2023

Conversation

dac09
Copy link
Collaborator

@dac09 dac09 commented Jun 23, 2023

What does it do?

It will swallowECONNREFUSED errors for the first 2.5s after launch, and replace it with "⌛ API Server launching, please refresh your page..."

Why can't you just remove the error?
Not an option, see vite code: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/proxy.ts#L53

Not an ideal solution - if someone else has a better solution, happy to close this PR.

This is what it looks like:
Screenshot 2023-06-23 at 16 08 02

And in the browser displays this message as before:
Screenshot 2023-06-23 at 16 22 33

@dac09 dac09 added the release:fix This PR is a fix label Jun 23, 2023
@dac09 dac09 added this to the v6.0.0 milestone Jun 23, 2023
@dac09 dac09 requested a review from thedavidprice June 23, 2023 09:29
@cannikin
Copy link
Member

Timeout to the rescue! This is much more elegant than what I was thinking, I had no idea about this configure thing!

@dac09
Copy link
Collaborator Author

dac09 commented Jun 24, 2023

Timeout to the rescue! This is much more elegant than what I was thinking, I had no idea about this configure thing!

Me neither, till I started looking into it!

@dthyresson
Copy link
Contributor

Thanks for this -- I noticed when using vite as well that the web side starts faster now :)

@dac09
Copy link
Collaborator Author

dac09 commented Jun 27, 2023

@cannikin would you please give it a once over? I think DP is busy.

@dac09 dac09 requested review from cannikin and removed request for thedavidprice June 27, 2023 17:23
@cannikin
Copy link
Member

I noticed that on Gitpod this fix basically has no effect since it takes so long for GitPod to start going:

image

But that's the downside to a setTimeout(), you never know how long it's going to take someone's system to get going. 2.5 seconds is more than enough time on my M1 Macbook, but for lots of other people it's not going to be. Just be prepared @thedavidprice that this fix isn't going to improve things for many people.

@jtoar jtoar merged commit 6903d3b into redwoodjs:main Jun 27, 2023
10 of 11 checks passed
@redwoodjs-bot redwoodjs-bot bot modified the milestones: v6.0.0, next-release Jun 27, 2023
@jtoar jtoar modified the milestones: next-release, v6.0.0 Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants