Skip to content

fix: Devtools timeline breaks function key injection #941

@cernymatej

Description

@cernymatej

🐛 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 nuxt/nuxt#34192 (comment)

🛠️ To reproduce

https://stackblitz.com/edit/github-cftzb7c6-w4klleco

🌈 Expected behavior

Wrapping should ideally happen after key injection, if possible.

ℹ️ Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions