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

Vue Devtools-Next errors when trying to evaluate pageContext #160

Closed
pdanpdan opened this issue Jul 22, 2024 · 12 comments
Closed

Vue Devtools-Next errors when trying to evaluate pageContext #160

pdanpdan opened this issue Jul 22, 2024 · 12 comments

Comments

@pdanpdan
Copy link
Collaborator

I'm not sure if this should be solved in vike or in devtools-next (https://github.com/vuejs/devtools-next) or in both.

When inspecting components that use usePageContext in script setup devtools will try to check some marker/well-known keys for internal purposes in prepare.js.

let n = G(()=>St(t.setupState[o])), r = e[o], s, a = typeof n == "function" || typeof (n == null ? void 0 : n.render) == "function" || typeof (n == null ? void 0 : n.__asyncLoader) == "function" || typeof n == "object" && n && ("setup"in n || "props"in n) || /^v[A-Z]/.test(o);

This will produce calls to getPageContextProxyForUser for key render at least, and that will produce an [vike][Wrong Usage] pageContext.render isn't defined on the client-side error.

It looks like normal (non-next) vue devtools works.

@brillout Maybe this should be forwarded to the vue devtools team, but I think you can decide better.

@brillout
Copy link
Member

Thank you for raising the issue. The getPageContextProxyForUser.ts file already has a couple of Vue-specific whitelisting logic. How about we whitelist render? Would that be enough?

If assertUsage() causes too many issues, then let's make it a assertWarning() instead.

@pdanpdan
Copy link
Collaborator Author

Maybe the whitelisting should be established together with the devtools team, so that is they check for something new they should notify in the vike repo.

@brillout
Copy link
Member

I agree, although I ain't sure how much interest they'll show in maintaining such list 🤔 Maybe it's worth a try.

@pdanpdan
Copy link
Collaborator Author

I'll make a simple repo showing the problem and open an issue on their repo referencing this issue.

@brillout
Copy link
Member

👍

@martijndirksen
Copy link

I would prefer a warning instead of assertUsage as well. Right now this error prevents the Vue devtools from listing the component contents entirely whenever PageContext is used.

@brillout
Copy link
Member

@martijndirksen Yea, let's give whitelisting a last chance and if we can't make it work then let's make it a warning. (Thanks for sponsonring btw! 💚)

@pdanpdan
Copy link
Collaborator Author

@brillout Can you please take over the technical part here?
vuejs/devtools#542 (comment)

@brillout
Copy link
Member

@pdanpdan Done 👍

@pdanpdan
Copy link
Collaborator Author

Fixed in devtools

@brillout
Copy link
Member

brillout commented Aug 1, 2024

Neat, thank you for reaching out @pdanpdan

@brillout
Copy link
Member

brillout commented Aug 1, 2024

I would prefer a warning instead of assertUsage as well.

This is the plan so far: vikejs/vike#1776.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants