fix: implement disableAppScope and disablePluginScope#1044
Open
skirtles-code wants to merge 1 commit intovuejs:mainfrom
Open
fix: implement disableAppScope and disablePluginScope#1044skirtles-code wants to merge 1 commit intovuejs:mainfrom
disableAppScope and disablePluginScope#1044skirtles-code wants to merge 1 commit intovuejs:mainfrom
Conversation
✅ Deploy Preview for vue-devtools-docs canceled.
|
@vue/devtools-applet
@vue/devtools-core
@vue/devtools
@vue/devtools-api
@vue/devtools-kit
@vue/devtools-electron
@vue/devtools-shared
@vue/devtools-ui
vite-plugin-vue-devtools
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.
Vue DevTools 6 had settings
disableAppScopeanddisablePluginScope, both defaulting tofalse.Currently, these settings appear in the types for Vue DevTools 8 but they don't actually do anything.
I don't know whether anyone actually uses these settings, but Vue DevTools 8 currently behaves as though they are set to
true, which is different from version 6.The code that implemented these settings in v6 is:
They are also documented at:
This difference from v6 has led to some problems in Vue Router and Pinia when working with multiple applications on the same page.
A couple of notes on my implementation:
anyin a couple of places. If anyone has a better suggestion please let me know.payload.app, which is slightly different from how v6 did it (usingctx.currentAppRecord). I'm not sure if this makes a difference, it seemed to work fine in my testing.I checked various libraries to see how they use
@vue/devtools-api. Some aren't using v8 yet, but Vue Router, Pinia and VitePress are notable examples that are.I've outlined the problems with those libraries below. This PR should fix these problems.
Vue Router
It's possible to have multiple apps with multiple routers on a page using
createMemoryHistory.Vue Router's integration with the DevTools is here:
This makes 4 calls to
app.onhooks. Two of them are checkingpayload.app === app, two aren't. The two that aren't lead to problems.The tags are duplicated and there are multiple
$routeentries.If we don't fix this in Vue DevTools then it'll need to be fixed in Vue Router instead.
Pinia
DevTools integration is here:
There are 5
api.oncalls and two are missing thepayload.app === app.I'm unclear what the call to
api.on.editComponentStateactually does. I haven't been able to find where this gets triggered in the DevTools. But from looking at how Pinia uses it, it looks like addingpayload.app === appwould be harmless and might even be necessary to ensure it updates the correctpiniainstance.The other is
api.on.inspectComponent, which leads to duplication in the DevTools:Again, if we don't fix this in Vue DevTools then it'll need to be fixed in Pinia instead.
VitePress
VitePress is using v8. The code for its integration is at:
That isn't checking
payload.app, which can lead to properties being injected in the wrong app.