Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(repl): avoid duplicate formatter mounts #10472

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

baiwusanyu-c
Copy link
Member

@baiwusanyu-c baiwusanyu-c commented Mar 7, 2024

close: #10466

@baiwusanyu-c baiwusanyu-c changed the title fix(repl): Avoid duplicate formatter mounts fix(repl): avoid duplicate formatter mounts Mar 7, 2024
Copy link

github-actions bot commented Mar 7, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.7 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB 53.7 kB 48 kB

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.5 kB 24.9 kB 22.5 kB

@@ -24,6 +24,7 @@ export function initCustomFormatter() {
// custom formatter for Chrome
// https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
const formatter = {
__formater_key: 'vue-custom-formatter',
header(obj: unknown) {
// TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this PR works, I prefer fixing the issue in the playground codebase.
Otherwise, we need some kind of versioning in the custom formatter.
Consider the scenario where we implemented the feature mentioned in this TODO comment in the future, and the page has loaded several versions of Vue; we would still need to add the latest custom formatter despite the presence of another version of Vue custom formatter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that I should modify @vue/sfc-playground and find a way to ensure that the custom formatter is always up to date when using multiple versions of vue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just modifying the sfc-playground package is enough.

There are very few cases that we need to worry about too many devtoolFormatters so the deduplication might be overkill.

@sodatea sodatea added ready for review This PR requires more reviews 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready for review This PR requires more reviews scope: playground
Projects
None yet
Development

Successfully merging this pull request may close these issues.

window.devtoolsFormatters increase on update
2 participants