fix: Devtools timeline breaks function key injection
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.3k
- Forks
- 214
- Avg merge
- 13h 22m
- Merged PRs (30d)
- 18
Description
🐛 The bug
When devtools.timeline.enabled is set to true, composables that rely on automatic key injection (useState, callOnce) fail at runtime due to the functions being wrapped in __nuxtTimelineWrap, which replaces the original import with a local variable declaration.
// example
const useState = __nuxtTimelineWrap("useState", _$__useState)
The keyed-functions plugin then sees a local variable instead of an import specifier and skips key injection.
first reported by @bbauti in https://github.com/nuxt/nuxt/issues/34192#issuecomment-3993534262
🛠️ To reproduce
https://stackblitz.com/edit/github-cftzb7c6-w4klleco
🌈 Expected behavior
Wrapping should ideally happen after key injection, if possible.
ℹ️ Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and trace the devtools.timeline wrapping alongside the keyed-functions plugin. Verify how __nuxtTimelineWrap changes the useState and callOnce bindings; done means automatic key injection still works and both composables run without runtime failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100