File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export function initCustomFormatter() {
2424 // custom formatter for Chrome
2525 // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
2626 const formatter = {
27+ __vue_custom_formatter : true ,
2728 header ( obj : unknown ) {
2829 // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
2930 if ( ! isObject ( obj ) ) {
Original file line number Diff line number Diff line change @@ -129,7 +129,13 @@ onMounted(() => {
129129 :preview-options =" {
130130 customCode: {
131131 importCode: `import { initCustomFormatter } from 'vue'`,
132- useCode: `initCustomFormatter()`,
132+ useCode: `if (window.devtoolsFormatters) {
133+ const index = window.devtoolsFormatters.findIndex((v) => v.__vue_custom_formatter)
134+ window.devtoolsFormatters.splice(index, 1)
135+ initCustomFormatter()
136+ } else {
137+ initCustomFormatter()
138+ }`,
133139 },
134140 }"
135141 />
You can’t perform that action at this time.
0 commit comments