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

warnHandler not invoked prior to app.mount() due to null stack / instance reference #5297

Open
smolgumball opened this issue Jan 20, 2022 · 4 comments

Comments

@smolgumball
Copy link

smolgumball commented Jan 20, 2022

Version

3.2.27

Reproduction link

jsfiddle.net

Steps to reproduce

  • Note logs in console
  • Note comment on line 11 of JS source

What is expected?

warnHandler be invoked for all warnings, even if app is not yet instanced / mounted.

What is actually happening?

warnHandler is skipped and internal warn handler runs.

Potentially related:

#4479

@LinusBorg
Copy link
Member

The warnHandler is meant to handle warnings from things happening in components, i.e. during render. it's not meant to catch this kind of warning, really. That's why it receives a vm as the second argument.

@smolgumball
Copy link
Author

That makes sense, but I'd think that internal warn's shouldn't be issued outside the scope of a component if that's the case. Having a warnHandler override that doesn't override all uses of warn seems unintuitive.

Would it be possible for warnHandler to be invoked with alternative arguments in the case that a component instance is not yet spun up?

@michael42
Copy link

This also happens when rendering a component server-side using @vue/server-renderer. How can we get the warnings during SSR to fail the request or at least print them in the browser?

@hokkaido
Copy link

@LinusBorg The default warn handler does not follow that pattern tho, it allows for instance vue-router to create copious amounts of warnings outside of the mount cycle without any way to ignore them.

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

4 participants