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

Setting server open to true focuses the tab when config.mts is changed #4040

Closed
4 tasks done
gkiely opened this issue Jul 13, 2024 · 4 comments
Closed
4 tasks done

Setting server open to true focuses the tab when config.mts is changed #4040

gkiely opened this issue Jul 13, 2024 · 4 comments
Labels
has-workaround Has workaround, low priority

Comments

@gkiely
Copy link

gkiely commented Jul 13, 2024

Describe the bug

Setting server open to true in the config.mts and changing the config will focus the localhost tab, this is unexpected and differs from how vite behaves normally.

Reproduction

import { defineConfig } from 'vitepress';

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "Example project",
  description: "An example project",
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: 'Home', link: '/' },
      { text: 'Examples', link: '/markdown-examples' }
    ],

    sidebar: [
      {
        text: 'Examples',
        items: [
          { text: 'Markdown Examples', link: '/markdown-examples' },
          { text: 'Examples', link: '/examples' }
        ]
      }
    ],

    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ]
  },
  vite: {
    server: {
      open: true,
    }
  },
})

Expected behavior

Tab does not focus

System Info

System:
    OS: macOS 12.7
    CPU: (10) arm64 Apple M1 Pro
    Memory: 2.87 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.12.1 - ~/.volta/tools/image/node/20.12.1/bin/node
    Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
    npm: 10.5.0 - ~/.volta/tools/image/node/20.12.1/bin/npm
    bun: 1.1.18 - ~/code/youneedawiki/node_modules/.bin/bun
    Watchman: 2023.04.10.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 114.1.52.129
    Chrome: 126.0.6478.127
    Edge: 126.0.2592.102
    Safari: 17.5

Additional context

https://www.loom.com/share/c1bc78328066473cae5d856530101559?sid=25891b7f-683f-4d26-a13e-425418fbea95

Validations

@gkiely gkiely added the bug: pending triage Maybe a bug, waiting for confirmation label Jul 13, 2024
@brc-dd
Copy link
Member

brc-dd commented Jul 13, 2024

Which vitepress version are you using?

@gkiely
Copy link
Author

gkiely commented Jul 13, 2024

Which vitepress version are you using?

1.3.0

@brc-dd
Copy link
Member

brc-dd commented Jul 13, 2024

Looks like vite.open is not supported yet. If you run with vitepress dev docs --open it should work fine.

@brc-dd brc-dd added enhancement has-workaround Has workaround, low priority and removed bug: pending triage Maybe a bug, waiting for confirmation labels Jul 13, 2024
@brc-dd brc-dd closed this as completed in 6263db1 Jul 13, 2024
@brc-dd
Copy link
Member

brc-dd commented Jul 14, 2024

Released a fix in v1.3.1. Should work fine now.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has-workaround Has workaround, low priority
Projects
None yet
Development

No branches or pull requests

2 participants