Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

feat: Improved realtime hooks monitoring

未关闭
#860 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
nuxtjs, typescript

调研方向

从现有的“Hooks”选项卡开始,查看相关的 Nuxt issue 和 pull request,然后检查报告中链接的 hookable 限制。在实现所请求的监控行为之前,解决有关事件捕获、过滤、时间戳、payload 存储和 listener hook 的未决设计问题。

由索引模型根据 Issue 内容生成。

描述

enhancement
🆒 Your use case

Related issues: https://github.com/nuxt/nuxt/issues/31892 and https://github.com/nuxt/nuxt/pull/31977

The current Hooks tab shows registered hooks and how many times they have been called. This is useful, but it would be even better if we could see the actual calls and listeners to the hooks in real time, including time stamps and the ability to filter by hook name and type (emit vs listen).

This is a common feature in many frameworks which let you monitor events in real time, and it would be a great addition to the Hooks tab. It would greatly improve the debugging experience.

Currently as you can see, when a hook is called, it only shows the number of times it has been called and the execution time. But it doesn't report when the hook was called, what the arguments were, and what listeners were called. There is also no way to filter hooks. This makes it more difficult to debug issues related to hooks.

Screencast

https://github.com/user-attachments/assets/11ca5e98-763b-4759-bb59-42796499666f

For example, here is how Events are monitored in Laravel. It shows a list of most recent events, how long ago it happened and supports filtering:

Image

There is also a current limitation of hookable which does not have an API to hook into the listener calls. It is only possible to hook into the callHook method but not the hook method. So we cannot report on the listeners that are called. I already opened an issue regarding this - https://github.com/unjs/hookable/issues/117

🆕 The solution you'd like

In our company we created a custom NuxtDevtools module for this. It has a lot of limitations but it shows both emit and listen events, shows a timestamp and allows filtering by name and type. Emits are green, listens are blue. It uses LocalStorage to log the events. I think this should be built into the core of Nuxt Devtools.

Screencast

https://github.com/user-attachments/assets/294d63cf-e87e-47d4-928b-ae24b0ca459a

Features

  • Show a list of hooks sorted by most recent
  • Show a time stamp of when the hook was called (both emit and listen)
  • Show the arguments passed to the hook
  • Show both emit and listen events
  • Allow filtering by hook name and type (e.g. show only callHook calls vs show only hook calls)
  • Support for regex filtering (e.g. /show this hook/ -/hide this hook/)

Discussion Points

[ ] Should this be integrated into the existing Hooks tab or should it be a separate Events tab?
[ ] Can we patch hookable to allow hooking into listener calls?
[ ] Default filters, e.g. show only user hooks, hide system hooks. Regex filtering support.
[ ] Where should the data be stored? In LocalStorage? What about SSR?
[ ] Storing payload in LocalStorage might quickly baloon in size, use different storage or have a limit for payload?

🔍 Alternatives you've considered

No response

ℹ️ Additional info

No response

主要语言
TypeScript
星标
3.3k
派生
214
平均合并
19 小时 45 分钟
30 天内合并 PR
12

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nuxt/devtools 的其他 Issue

查看 nuxt/devtools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。