Skip to content

Comments

fix:修复快捷键的小问题#78

Open
niechy wants to merge 4 commits intoMistEO:mainfrom
niechy:main
Open

fix:修复快捷键的小问题#78
niechy wants to merge 4 commits intoMistEO:mainfrom
niechy:main

Conversation

@niechy
Copy link
Contributor

@niechy niechy commented Feb 21, 2026

image 之前第一次启动没解析

改了任务,快捷键执行的还是之前的
fixed MaaEnd/MaaEnd/issues/513

按下启动,如果按下时间稍长,可能启动多次任务
fixed MaaEnd/MaaEnd/issues/620

Summary by Sourcery

改进用于快捷键的任务启动行为,并修正资源显示名称。

Bug Fixes:

  • 修复工具栏资源显示名称,以在可用时遵循本地化标签。
  • 防止全局和应用内启动快捷键在短时间内触发多次任务启动。
  • 确保由快捷键触发的任务启动始终使用最新的实例/任务状态,而不是过期的闭包。
Original summary in English

Summary by Sourcery

Improve task start behavior for hotkeys and correct resource display naming.

Bug Fixes:

  • Fix toolbar resource display name to respect localized labels when available.
  • Prevent global and in-app start hotkeys from triggering multiple rapid task starts.
  • Ensure hotkey-triggered task starts always use the latest instance/task state instead of stale closures.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些整体上的反馈:

  • 建议把 starting 标志存储在 useRef 中,而不是在 effect 内部使用本地的 let 变量,这样它的值在重新渲染之间会保持稳定,也能更清晰地体现出防止并发启动的意图。
  • 全局快捷键处理程序中的 1000 ms 保护值是一个魔法数字;将其提取为一个具名常量(或配置项)会让节流行为更容易理解和调整。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider storing the `starting` flag in a `useRef` rather than a local `let` inside the effect so its value is stable across re-renders and the intent of guarding against concurrent starts is clearer.
- The `1000` ms guard in the global hotkey handler is a magic number; extracting it into a named constant (or configuration) would make the throttle behavior easier to understand and adjust.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据这些反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • Consider storing the starting flag in a useRef rather than a local let inside the effect so its value is stable across re-renders and the intent of guarding against concurrent starts is clearer.
  • The 1000 ms guard in the global hotkey handler is a magic number; extracting it into a named constant (or configuration) would make the throttle behavior easier to understand and adjust.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider storing the `starting` flag in a `useRef` rather than a local `let` inside the effect so its value is stable across re-renders and the intent of guarding against concurrent starts is clearer.
- The `1000` ms guard in the global hotkey handler is a magic number; extracting it into a named constant (or configuration) would make the throttle behavior easier to understand and adjust.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- Toolbar: starting 标志从局部变量改为 useRef,避免重渲染丢失状态
- App: 全局快捷键节流 1000ms 提取为 GLOBAL_HOTKEY_THROTTLE_MS 常量
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant