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

fix(cli): after setting server.open, the default open is inconsistent… #11974

Merged
merged 3 commits into from
Feb 23, 2023

Conversation

kinfuy
Copy link
Contributor

@kinfuy kinfuy commented Feb 8, 2023

… with the shortcut key (#11971)

Description

fix #11971

After setting server.open, the default open is inconsistent with the shortcut key,Now only the shortcut key processing has been modified

PS: Another point is that the displayed urls are also inconsistent. I don't know whether to handle them

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

packages/vite/src/node/shortcuts.ts Outdated Show resolved Hide resolved
@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Feb 13, 2023
@bluwy
Copy link
Member

bluwy commented Feb 13, 2023

PS: Another point is that the displayed urls are also inconsistent. I don't know whether to handle them

Do you mean the displayed URL in the CLI is inconsistent between runs? If there's a way to reproduce them, it would help identify where to fix.

@kinfuy
Copy link
Contributor Author

kinfuy commented Feb 14, 2023

PS: Another point is that the displayed urls are also inconsistent. I don't know whether to handle them

Do you mean the displayed URL in the CLI is inconsistent between runs? If there's a way to reproduce them, it would help identify where to fix.

The server. open is set, and the displayed URL is inconsistent with the default one (shortcut key)

 server:{
    open:'/test'
  },

截屏2023-02-14 22 56 15

@bluwy
Copy link
Member

bluwy commented Feb 18, 2023

I believe that's intentional, the displayed URL shows the base path where it's being served, while server.open can be used to open another URL (e.g. for quick dev). I think it's fine to have them inconsistent as they serve a different purpose.

@kinfuy
Copy link
Contributor Author

kinfuy commented Feb 19, 2023

I believe that's intentional, the displayed URL shows the base path where it's being served, while server.open can be used to open another URL (e.g. for quick dev). I think it's fine to have them inconsistent as they serve a different purpose.

If open. server sets a string, maybe we can give a prompt and display an open URL separately.
If necessary, I can open a new PR
截屏2023-02-19 12 01 21

@kinfuy kinfuy requested a review from bluwy February 19, 2023 04:04
@bluwy
Copy link
Member

bluwy commented Feb 23, 2023

If open. server sets a string, maybe we can give a prompt and display an open URL separately.

I'm slightly leaning towards not needing one for now because when --open is specified, it would open the browser immediately and the user knows what's the URL directly. The could use the o shortcut too if they forgot about it 🤔

@kinfuy
Copy link
Contributor Author

kinfuy commented Feb 23, 2023

If open. server sets a string, maybe we can give a prompt and display an open URL separately.

I'm slightly leaning towards not needing one for now because when --open is specified, it would open the browser immediately and the user knows what's the URL directly. The could use the o shortcut too if they forgot about it 🤔

This can also be done, because now it will cause a visual confusion, why the shortcut key and default open are not the displayed address.
Of course, I may know if I set it myself. It may be forgotten when developing by many people. This is a small feature. There is no problem without adjustment

packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
@kinfuy kinfuy requested a review from bluwy February 23, 2023 11:55
@patak-dev
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Feb 23, 2023

📝 Ran ecosystem CI: Open

suite result
astro ❌ failure
histoire ✅ success
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ✅ success
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ❌ failure
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Running ecosystem CI just in case. Nobody should be using startServer isRestart but it was part of the public API.

@bluwy
Copy link
Member

bluwy commented Feb 23, 2023

The Astro fail seems to be a fluke, I just re-ran it. This LGTM too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

vite opens server.open URL on startup but sequenetly pressing the 'o' key opens 'http://localhost:5173/'
3 participants