Repository navigation
fix(kit): scope plugin hooks per app - #1162
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for vue-devtools-docs canceled.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When several Vue apps on one page register the same plugin id (Pinia does this once per app), the kit kept a single adapter per id and overwrote its
descriptor.appwith the latest app. App scoping then rejected hook payloads for every other app, so their custom inspectors came back empty. For example, only the last app to register Pinia showed its stores in the Pinia tab.This is a v9 regression. In v8.2.1 each
setupDevtoolsPlugincall got its own API bound to its own descriptor.Fix
registry.ts: a privateRegisteredPluginper plugin id keeps one adapter per app. A setup for a known app reuses that app's adapter; a new app gets its own; a setup without an app joins the first. Descriptor metadata is merged into all of them. Hook calls go to every adapter, and each one filters by its own app as before.settings.ts(internal, not exported):PluginSettingsholds setting values per plugin id and is shared by all adapters of that id. A change reaches every app'ssetPluginSettingshandlers with the correctoldValue.createPluginApiAdaptertakes the settings store as a new optional argument. No existing exported type changes.Note:
plugins.adaptersstill maps a plugin id to its first adapter. That adapter backs the plugin snapshot and settings commands; per-app adapters are internal.Verification
New tests in
tests/unit/plugin/v6-compat.test.ts:main)setPluginSettingsreaches handlers from every apppnpm vitest run tests/unit tests/integrationpasses (366 tests).Manually checked in
playground/basicwith a second app that has its own Pinia (pinia 4.0.3), querying each app'spiniainspector tree:maincounter,labcounter,labwidget🤖 Generated with Claude Code