blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

delay between `blitz new` prompts with slow internet #290

Closed beerose closed 3 years ago

beerose commented 3 years ago

What is the problem?

When a user has a slow network, there is a delay between "install deps?" prompt and "form library" prompt. It's because after install deps step, we are fetching the latest blitz version to see if cli needs to be updated. It looks like cli is stuck because of no activity indicator.

Possible implementations:

Paste all your error logs here:

n/a

Paste all relevant code snippets here:

n/a

What are detailed steps to reproduce this?

  1. Downgrade Blitz to an older version if you're on the latest.
  2. Run blitz new.
  3. See what happens after install deps? prompt.

Run blitz -v and paste the output here:

n/a

Please include below any other applicable logs and screenshots that show your problem:

No response

flybayer commented 3 years ago

Here is the code that handles the upgrade check, and that either needs a spinner or, maybe even better, network request moved to the background: https://github.com/blitz-js/blitz/blob/canary/packages/cli/src/commands/new.ts#L105-L112

g3offrey commented 3 years ago

I'm working on this 😄

g3offrey commented 3 years ago

I tried to think about both of the solutions (the spinner, and the background task one). I'm not sure the second one is the best in terms of user experience. Indeed, what happen if the user is in the middle of the prompting part when the request finish. Should we take it back at the start? Record his answers? What happen if the prompting questions change between the version used initially and the upgraded one? 🤔

I think the spinner solution is a good one in terms of UX per developing time.

Hope my code is good enough. Don't hesitate to request a change to the pull request, I'll be glad to update it. 😄

On a second hand I want to thank you @flybayer and the Blitz team for doing such an awesome work on the project. I really love using Blitz and contributing to it is really nice. The codebase is very clean ✌️