You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compiler-core: :key expression not prefixed when element has v-memo without v-for (ReferenceError at runtime) #14920
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.has workaroundA workaround has been found to avoid the problemscope: compiler
Open the playground link; it throws on load.
The trigger is v-memo + dynamic :key on a plain element without v-for, where the key references a prop
What is expected?
:key expression is prefixed like any other (__props.updateKey / _ctx.updateKey), as in ≤3.5.12
What is actually happening?
transformExpression skips the :key expression whenever the element has v-memo (the !(memo && arg.content === 'key') check added in 99009ee / PR #12014), assuming transformFor processed it eagerly — but that only happens when v-for is also present.
Plain elements fall through → unprefixed key → ReferenceError at runtime
This happened after vue version update.
We hit this in a component library's scroll-container component. It renders custom scrollbars, so its reactive scroll state changes on every scroll frame; to keep large slotted content (e.g. a table body with thousands of cells) from re-rendering on each frame, the content wrapper uses v-memo="[updateKey]" with :key="updateKey" on the same element — "freeze this subtree, and when the parent bumps updateKey (data reload, layout change), rebuild it from scratch instead of diffing."
This compiled and ran correctly up to compiler 3.5.12; from 3.5.13 the generated render function references the key as a bare identifier and every page using the component throws ReferenceError on first render.
Current workaround: v-bind="{ key: updateKey }" instead of :key="updateKey", which bypasses the skipped code path and produces a correctly prefixed expression.
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.has workaroundA workaround has been found to avoid the problemscope: compiler
Activity
fix(compiler-core): prefix dynamic keys on v-memo elements (#14922)
chore(deps): update vue monorepo to v3.5.38 (#167)