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: console logging for component instance proxies #62

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

skirtles-code
Copy link
Contributor

Console logging currently fails when the logged value is a component instance proxy:

SFC Playground Example

Those proxies cannot be passed to String() without throwing the error:

TypeError: Cannot convert object to primitive value

There were a couple of places that potentially pass those proxies to String(). The first (line 134) could be removed and replaced by a typeof check. The second I have replaced with a toString() helper function that handles error cases more gracefully.

The stringify function also caused problems because it attempts to enumerate the component's properties, leading to a warning. I've tweaked that to avoid that warning.

I've also moved the call to the original log function higher up. This helps to ensure that it still happens, even if an unexpected error occurs in the other code.

@yyx990803 yyx990803 merged commit bb0e143 into vuejs:main Jun 14, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants