Component that has error is not being rendered #1993
-
Hi there, hoping you're having a good start of the week! I have been bothered by the issue for a couple of time now, since upgrading to Ruby 3.3.0 and Rails 7.1.3. If a component has some sort of error in it, i.e logical, or undefined parameters, instead of raising an error so I can see where things are going wrong. ViewComponent simply does not render the component, this is very cumbersome for debugging and I haven't found the cause for this yet. Any ideas what might be causing this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
@rockwellll this is the first I've heard of this issue, would you be up for writing a PR with a failing test for this problem? |
Beta Was this translation helpful? Give feedback.
-
@joelhawksley thanks for the answer! I've did some further investigation, it does not seem to VC's fault per se, rather something from Rails. I'm trying to render a component that has a reference to an undefined variable, and VC correctly reports the error
When combine this with the
The raised error seems to become empty, I'm not sure where things are being rescued from. I checked the view_component/lib/view_component/compiler.rb Lines 62 to 68 in 4ae1dfc But logs seem to become slience at this stage. I'll investigate this further and keep you updated. Is this still related to VC in your thoughts? |
Beta Was this translation helpful? Give feedback.
-
@joelhawksley hi. I just had time to setup what you suggested, and it seems that the issue is on my end. I've added a component that throws an error, VC correctly catches the problem. I know this is a hard question to guess. But you've any idea what we might be doing to cause this? |
Beta Was this translation helpful? Give feedback.
-
@joelhawksley found the error. It was NewRelic catching the errors reported by VC and swallowed it, I followed this StackOverflow answer which led me to #1981. Thanks! |
Beta Was this translation helpful? Give feedback.
@joelhawksley found the error. It was NewRelic catching the errors reported by VC and swallowed it, I followed this StackOverflow answer which led me to #1981.
Thanks!