Vue: Better error message for Recursive components

Created on 2 Aug 2017  路  7Comments  路  Source: vuejs/vue

What problem does this feature solve?

Currently it's next to impossible to debug errors about components referencing them selves (by accident in my case).

This has apparently allready been proposed as part of the discussion of another Ticket (#3371).

What does the proposed API look like?

No API change, just a better error message to source the file causing issues.

need repro

Most helpful comment

I hinted at the "better" error message in the API change section, sorry if I was unclear.

  • [ ] be able to get the source file of the error
  • [ ] have the name of the component causing the issue

Thanks

All 7 comments

What is "better" to you, in this sitation? And what was the situation to begin with?

For us to improve on error messages, we have to understand what mistake on your part lead to the error that you mention above, and optimally to hear from you what you might consider a more helpful error message.

I hinted at the "better" error message in the API change section, sorry if I was unclear.

  • [ ] be able to get the source file of the error
  • [ ] have the name of the component causing the issue

Thanks

And the issue that caused this message was ... that you accidentally tried to render a component in itself, recursively?

The error message tells you that:

  • the name of the element
  • that this error is possibly retelated to a recursive component render
  • When used with vue-loader, you usually also get the filename of the component that is causing the issue through the generated component trace

So I'm not sure what you have been more helpful, especially since I stil have not fully understood what mistake you made to trigger this error.

It's hard to improve a message for a mistake that I have no demonstration of...

I had the issue by (re-)importing a component and defining it via the "components" prop.

The component was allready imported globally via a Vue.use().

The component was not beeing called recursively but probably the parent component instance did not know what component to instantiate.

The error was unclear about me overriding an allready existing component.
Generally speaking the current error message is to generic. (Covers multiple errors, not only the one it's intended to cover)

Hm, now is the point where I really have to ask for a reproduction, because generally you can overwrite a component, no problem. There's no instance where "probably the parent component instance did not know what component to instantiate."

And if there were, this error should not show up. It should only show up when

  • you use a <some-component> tag in the template that Vue doesn't know at all (not registered)
  • you recursively call a component that is missing a name property

Both things are explained in the error message. Other errors should not be catched by this.

Will repro this as soon as I can, no worries.

Closing due to inactivity. Please open a new issue with a reference to this one if you can follow up with more information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karevn picture karevn  路  42Comments

Akryum picture Akryum  路  34Comments

eu81273 picture eu81273  路  40Comments

yyx990803 picture yyx990803  路  36Comments

rpkilby picture rpkilby  路  50Comments