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

Improve error messages for "no component found matching phx-target" error #3619

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

s3cur3
Copy link
Contributor

@s3cur3 s3cur3 commented Jan 7, 2025

When "no component found" errors occur, they are extremely difficult to debug ("What component did we expect to exist at target 2? 🤷‍♂️"). This improves the console.error log to include the element we expected the component to exist within, which should help at least somewhat.

It might be worth throwing an exception here so that people's automated exception tracking (Sentry, etc.) will pick it up. Since the LiveView is effectively dead in the water at this point, it seems like something that it'd be good to have more observability around. I didn't include that change in this PR, but I'm happy to do so if it's desired.

@s3cur3 s3cur3 marked this pull request as ready for review January 7, 2025 15:46
@SteffenDE
Copy link
Collaborator

@s3cur3 I‘m not sure if this really helps. The viewEl points to the root element of the whole LiveView, so it just tells you that it expected to find it in the there somewhere. If that’s what you’re trying to do (for example with nested LiveViews) it might make more sense to log this.id instead?

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

Successfully merging this pull request may close these issues.

2 participants