Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(api): introduce inspectSetupState #450

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

Open
alexzhang1030 wants to merge 4 commits into vuejs:main
base: main
Choose a base branch
Loading
from alexzhang1030:feat/api-inspect-state

Conversation

@alexzhang1030
Copy link
Member

@alexzhang1030 alexzhang1030 commented Jun 16, 2024
edited
Loading

closes #376

This is very useful when using defineComponent with setup returning the render function.

const Component = defineComponent({
 setup() {
 const name = ref('foo')
 inspectSetupState({
 name,
 })
 return h('div', name.value)
 },
})

Copy link

netlify bot commented Jun 16, 2024
edited
Loading

Deploy Preview for vue-devtools-docs canceled.

Name Link
🔨 Latest commit 0b6464b
🔍 Latest deploy log https://app.netlify.com/sites/vue-devtools-docs/deploys/66d7bd95a1973000086a777b

Copy link
Member

webfansplz commented Jun 16, 2024
edited
Loading

I’m not sure about it. I don't think most users will use it manually to inspect it. If we can't handle it automatically in devtools at the moment, I think the better solution is to expose some possibilities in vue core.
But it might work as a helper to help some developers who want this feature, I'll check it out later!

Copy link
Member Author

I’m sure about it. I don't think most users will use it manually to inspect it. If we can't handle it automatically in devtools at the moment, I think the better solution is to expose some possibilities in vue core. But it might work as a helper to help some developers who want this feature, I'll check it out later!

If the setup returns a render function, which will be a closure, it becomes challenging for vue/core to register the setup state without static analysis. An existing PR, #5383, aims to add a debug API. However, I believe it would be more appropriate to integrate this function into vue-devtools.

webfansplz reacted with thumbs up emoji

Copy link

pkg-pr-new bot commented Sep 4, 2024
edited
Loading

Open in Stackblitz

@vue/devtools-core
pnpm add https://pkg.pr.new/@vue/devtools-core@450
@vue/devtools
pnpm add https://pkg.pr.new/@vue/devtools@450
@vue/devtools-api
pnpm add https://pkg.pr.new/@vue/devtools-api@450
@vue/devtools-kit
pnpm add https://pkg.pr.new/@vue/devtools-kit@450
vite-plugin-vue-devtools
pnpm add https://pkg.pr.new/vite-plugin-vue-devtools@450

commit: 0b6464b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@webfansplz webfansplz Awaiting requested review from webfansplz

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

When setup returns a render function, is it possible to obtain the state of refs?

AltStyle によって変換されたページ (->オリジナル) /