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

improve: duplicate git exec in hmr of git changelog plugin #207

Open
northword opened this issue May 12, 2024 · 2 comments
Open

improve: duplicate git exec in hmr of git changelog plugin #207

northword opened this issue May 12, 2024 · 2 comments
Labels
bug Something isn't working pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog

Comments

@northword
Copy link
Member

HMR 中重复的 Git 请求。

当前在 changelog.vue 中和 contributors.vue 中分别 send 了一次,这导致 Git 实际上被运行了两次(即使有设置的缓存,但是似乎因为两次执行的太近了,导致两次都是实际运行了 Git 的,从下面这个日志可以看出:

image

@nekomeowww
Copy link
Member

不知道配合 VueUse 的 useMounted + watch 能不能做一个更好的 store 共享一下。

@nekomeowww nekomeowww added bug Something isn't working pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog labels May 14, 2024
@northword
Copy link
Member Author

刚刚试了试在 client throttle ,似乎不可行。

也许可以在 vite 端做 throttle ;

或者做一个更大的组件,把 Changelog 和 Contributor 都放进来,这样就只需要在这个更大的组件里 import.meta.hot.send ,这样就可以避免两个组件都发送。

useMounted + watch 这种我不太清楚怎么实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog
Projects
None yet
Development

No branches or pull requests

2 participants