Skip to content

fix: render components under an app context without a component registry - #3044

Merged
cexbrayat merged 2 commits into
vuejs:mainfrom
ValentinYoushkevich:fix/stubs-app-context-without-registry
Nov 25, 2026
Merged

cexbrayat merged 2 commits into
vuejs:mainfrom
ValentinYoushkevich:fix/stubs-app-context-without-registry

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

Since #2996 (2.6.0), a component rendered under an app context whose components is null throws in the stubs transformer:

TypeError: Cannot read properties of null (reading 'transition')

(The key is the first configured stub, transition with the default config. With no stubs configured at all it is Invalid value used as weak map key instead.)

element-plus builds such a context for the table's overflow tooltip: vm.appContext = { ...table.appContext, ...table }. Spreading the instance replaces components with the instance's null. Vue itself tolerates that (resolveAsset skips a missing registry), and 2.5.1 renders it fine. With 2.6.0, 13 of the 93 tests in element-plus' table.test.ts fail (the first throw also breaks later mounts in the file); with this patch all 93 pass.

The lookup added in #2996 passes instance.appContext.components straight to getGlobalStubKey, which reads keys from it and uses it as a WeakMap key. This skips the lookup when there is no registry (2.5.1 had no such lookup at all). Stubs by name still apply under such a context.

Playground (2.6.0): https://play.vuejs.org/#eNqdVU2P2zYQ/SsDXUQhMhUUbQ/C7iLFYoEWSHponJx0CCPRlrIUqfLD7sLxf++QFC3bu0GC+CCL5Hw8vnkzOmR/TBPdOZ7V2Y1p9TBZMNy66a6RwzgpbeHQSIBWc2Y52pbL6uPfquNh3fHNIPm9QgfJpQ17W27vnda4/Esay2QbTfvw1Hwz/8uOa2BmfltCrjWTZrCDko08wkarEXKEmS+wYFROWkiHb/C0stzYlbODMGjYyFZhalDOwq1PSXLtpBzkllKaF96gqoALPiLI1SRcQmHA9hws+yw4qB3XG6H2YJUSdphADI941g8meJOJtY9sy03VptubKnhWRreVh0KtqX97/WtRBweA3UjZNN0rafl/HtgBEE5wOdsvT5twDH5rRGQm5L2DYeYTeuTt05K3BumE+EQbuXGy9dTByB590YhQ22IuZKAkZEHybq9LRw4zBzWQAm7voCe5mZjMS8gTAx5fXsARGUzx1vPRC/G8USr0EnQpbxlQl0gDujIn7GI0o0ypLhIGar6ZLkgYw8zL5BUJvX1BmyTEjkit0zJiSHsoW7K8A1LR5UGl6XfKE39KvlPOcIy/3PnKJEHCp2V4Be0vo1rntUhjfz1EZZK8G3ZerpfuVj89j5mi7kYMd9alZC7Qsyg/JcfrEGe9S3ZjudzphXSoRKq5wTp7hMmQDhKff67fvYWvXyEnfJzsU4E9fOl8hJbZtgfCz0r7jdi57bXaG8jhFfBngS43LpbHi8rmLRfiDMh8peARBTkL5vuNFDQbxYzujUSRroeR43gizDzJ9lwosYyTQHZ8TUK6uMfFjyjlNK9JGgEhVlHQMDUJF8GMC/qv4/rpPU7B1ipNvLIL2g3Y80j0w85HlXwP8S1H51nWeREG6Elw1l3h3GuUT5B1zJhwoKV3BWB7NpzMKJLXzdmtHrZbjljOs8VkyBXdMeGwiWMd8n8e3n94uwZyNf7hF/o7fV1C7+c3MPBVLE8zPFaGd/7DczH/O8VN0TQSRTPHjyU40VkHPYXNJLVXkF94fFx/iFeuk4TQBG8922Px8TI3VfzY4ojBhUW9C0wQBs4NTvm7wyF8to7Hm8ovvcOZUVZm8Su4GtlEvxgl8fMddNPMB6bJ6tQiTXZFjj9rst7aydRV5eT0uKX4GamuzN4EDisUg63wZLWcUG7G1WffXli5LxgvdEOQdXb8H402q1o=

@netlify

netlify Bot commented Nov 19, 2026

Copy link
Copy Markdown

👷 Deploy request for vue-test-utils-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 400f539

@pkg-pr-new

pkg-pr-new Bot commented Nov 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vue/test-utils@3044

commit: 400f539

@cexbrayat
cexbrayat merged commit beffe17 into vuejs:main Nov 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants