valaxy icon indicating copy to clipboard operation
valaxy copied to clipboard

0.22.17 version cannot hot update after i modify and save the article

Open IAMIBM opened this issue 8 months ago • 16 comments

Describe the bug

0.22.17 version cannot hot update after i modify and save the article,the same with F5 or Ctrl +F5 key refresh. restart valaxy will be OK.

Image

Reproduction

N/A

System Info

valaxy: 0.22.17  
Node: 22.14.0
pnpm: 10.6.3

Used Package Manager

pnpm

Validations

  • [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

IAMIBM avatar Mar 26 '25 06:03 IAMIBM

I attempted to create a new template with pnpm create valaxy, but I failed to reproduce the issue.

YunYouJun avatar Mar 27 '25 13:03 YunYouJun

I attempted to create a new template with pnpm create valaxy, but I failed to reproduce the issue.

It's weird. I recreate valaxy on Windows 10,the problem still exists. But on Debian 12, it's all right.

IAMIBM avatar Mar 28 '25 08:03 IAMIBM

I had the same problem on Windows 10, but vitepress worked just fine.

fanghsiu avatar Mar 28 '25 09:03 fanghsiu

0.22.17 Only partial dependencies and theme configurations were upgraded, with almost no changes in code functionality. I suspect this is caused by a certain upstream dependency and is related to Windows compatibility issues.

https://github.com/vitejs/vite/issues/18217

YunYouJun avatar Mar 28 '25 10:03 YunYouJun

Image

https://vite.dev/config/server-options#server-watch

YunYouJun avatar Mar 29 '25 16:03 YunYouJun

I had a similar issue where updating a .ts file would correctly reload the page, but updating a .vue file wouldn't, so I added this to vite.config.ts plugins (but it feels like a hack)

    {
      name: "full-reload",
      handleHotUpdate({ server }) {
        server.ws.send({ type: "full-reload" });
        return [];
      },
    },

maelp avatar Apr 14 '25 21:04 maelp

I had a similar issue where updating a .ts file would correctly reload the page, but updating a .vue file wouldn't, so I added this to vite.config.ts plugins (but it feels like a hack)

{
  name: "full-reload",
  handleHotUpdate({ server }) {
    server.ws.send({ type: "full-reload" });
    return [];
  },
},

May I ask what kind of environment you are in? Windows or macOS?

YunYouJun avatar Apr 15 '25 02:04 YunYouJun

macOs

maelp avatar Apr 15 '25 17:04 maelp

I am unable to reproduce this problem. Try 0.23.0, does it work? I upgraded the vite version.

Or create a reproducable demo in https://stackblitz.com/edit/valaxy?

YunYouJun avatar Apr 18 '25 06:04 YunYouJun

I am unable to reproduce this problem. Try 0.23.0, does it work? I upgraded the vite version.

@YunYouJun Same problem. I'm going to create new issue untill I find this one. Here are the details:


Recently I upgraded the blog framework version, from 0.19 directly to 0.23.

When adding and modifying articles, it was found that the hot reloading of web page previews was not working properly:

  1. Adding/removing articles (by adding/removing md files, cli has no response, browser ctrl+F5 does not work), and after removing a md file, clicking a post's url will lead to error on server.
  2. Modifying article content/frontmatter data (cli has no response, browser ctrl+F5 does not work)

And as others said, modifying some script files would works.

Initially, this issue was discovered during testing on Windows, and subsequently, a new node environment was set up in WSL2 with dependencies installed, but it still did not work properly. My OS info:

## Windows


  System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 AMD Ryzen 5 7500F 6-Core Processor
    Memory: 7.26 GB / 31.59 GB
  Binaries:
    Node: 22.15.0 - D:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - ~\AppData\Local\pnpm\yarn.CMD
    npm: 10.9.2 - D:\Program Files\nodejs\npm.CMD
    pnpm: 10.9.0 - D:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (135.0.3179.73)
    Internet Explorer: 11.0.26100.1882


## WSL


  System:
    OS: Linux 6.6 Debian GNU/Linux trixie/sid
    CPU: (12) x64 AMD Ryzen 5 7500F 6-Core Processor
    Memory: 13.17 GB / 14.63 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.1/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: 10.9.0 - ~/.nvm/versions/node/v20.15.1/bin/pnpm
  Browsers:
    Chrome: 135.0.7049.114

My project and its package.json file: https://github.com/lkyu-ly/lkyu-blog-valaxy/blob/main/package.json

Hope the problem to be solved.

lkyu-ly avatar Apr 26 '25 05:04 lkyu-ly

Now I have reproduced this problem and I will fix it as soon as possible.

YunYouJun avatar Apr 26 '25 07:04 YunYouJun

@lkyu-ly Is your blog files located under Windows system, while the valaxy command is executed in WSL2?

YunYouJun avatar Apr 27 '25 06:04 YunYouJun

yep. If needed I'll move it into the wsl2 file system for testing.

---Original--- From: @.> Date: Sun, Apr 27, 2025 14:23 PM To: @.>; Cc: @.@.>; Subject: Re: [YunYouJun/valaxy] 0.22.17 version cannot hot update after imodify and save the article (Issue #518)

YunYouJun left a comment (YunYouJun/valaxy#518)

@lkyu-ly Is your blog files located under Windows system, while the valaxy command is executed in WSL2?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

lkyu-ly avatar Apr 27 '25 06:04 lkyu-ly

@lkyu-ly Is your blog files located under Windows system, while the valaxy command is executed in WSL2?

After recloning the repo to WSL fitesystem to make it fully run in WSL, it is able for v0.23.2 to trigger hmr update.

Image

Howerver, the preview in browser won't hot update. Refresh the page in the browser would display the changes just made.

lkyu-ly avatar Apr 28 '25 01:04 lkyu-ly

@lkyu-ly Is your blog files located under Windows system, while the valaxy command is executed in WSL2?@lkyu 您的博客文件是否位于 Windows 系统下,而 valaxy 命令是在 WSL2 中执行的?

After recloning the repo to WSL fitesystem to make it fully run in WSL, it is able for v0.23.2 to trigger hmr update.将存储库重新克隆到 WSL fitesystem 以使其在 WSL 中完全运行后,v0.23.2 能够触发 hmr 更新。

Image

Howerver, the preview in browser won't hot update.此外,浏览器中的预览不会热更新。 Refresh the page in the browser would display the changes just made.在浏览器中刷新页面将显示刚刚所做的更改。

The problem in wsl2/windows is the restrict of wsl. See server-watch | vite. I think you have to manually enable usePolling.


In wsl2(with linux file system), the second startup should be normal. This might be caused by some cache. But I haven't found the reason yet.

YunYouJun avatar Apr 28 '25 06:04 YunYouJun

The problem in wsl2/windows is the restrict of wsl. See server-watch | vite. I think you have to manually enable usePolling.

Oh I see, it feels like this issue can also be included in the project documentation as a tip, after all, more and more people are using WSL. (I'm also working on a post which introduces WSL to let my friends know about it :)

In wsl2(with linux file system), the second startup should be normal.

That's true for me, and it hardly affects usage and development now. Thank you for your efforts! It seems that in next version the CLI shortcuts will work properly, then manually pressing r to restart after running is not a troublesome operation. HOORAY!

lkyu-ly avatar Apr 28 '25 08:04 lkyu-ly

我遇到了类似的问题, 在最新版本仍然能复现, 即使用 pnpm create valaxy 创建一个新的项目也是一样, 可以把这个 issue 重新打开吗? @YunYouJun

https://github.com/user-attachments/assets/86b52121-0b03-4a67-af59-b2e74491fc41

krau avatar Aug 06 '25 02:08 krau

我遇到了类似的问题, 在最新版本仍然能复现, 即使用 pnpm create valaxy 创建一个新的项目也是一样, 可以把这个 issue 重新打开吗? @YunYouJun

WSL 或 usePolling 是否可以解决该问题?

YunYouJun avatar Aug 06 '25 12:08 YunYouJun

WSL 或 usePolling 是否可以解决该问题?

在 wsl 中创建项目和启动开发服务器的话正常, 在 windows 上使用 usePolling 也不能解决

krau avatar Aug 06 '25 14:08 krau