-
Notifications
You must be signed in to change notification settings - Fork 404
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
Update filter in source_location to use base_label #2009
Update filter in source_location to use base_label #2009
Conversation
Co-authored-by: jasonkim <jasonkim@github.com>
5b9b745
to
3388241
Compare
🤯 incredible! Thank you for your hard work! Mind adding a little more detail about why we needed this change in the changelog entry and in a code comment? |
Of course! I also updated the PR description with more details, I hope it's not too much 🙊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Makes me wonder if we should test against HEAD for Ruby and not just Rails 🤔
Might y'all want to add yourselves to the contributors list on index.md
?
@joelhawksley I think adding ruby-dev would be a very wise idea, maybe we should also consider testing YJIT compatibility aswell. |
Sounds good. Would you be up for looking into adding one or both to CI? |
@joelhawksley I would be happy to I will keep you posted 👍 |
What are you trying to accomplish?
Fix ViewComponent compilation error that happens on a upstream ruby version.
Why do we need this change?
We need this to make sure templates are being correctly populated in a future ruby release.
The call stack filtering was added by #281 to correct finding the template for child components. But unfortunately we started to see the following error happening in tests when running against the ruby version ruby/ruby@d4a6c65...1232975:
After some digging looks like this ruby change adds the method owner in backtraces, which in turn made the view component filtering stop working. The filtering would look for the label
inherited
in the call stack and filter them, but since that ruby change was introduced the label includes the method owner as prefix, so it’s being returned asApplicationComponent.inherited
:Here's the
caller_locations
on the ruby sha1232975398a96af3070463292ec0c01e09a06c50
(newer version):And here's the
caller_locations
on the ruby sha5124f9ac7513eb590c37717337c430cb93caa151
(our current version):This has caused the filter to stop working and templates to not be correctly populated for the child ViewComponent, which led to the error when trying to compile it.
What approach did you choose and why?
This goes back to work if instead of filtering by
label
we can usebase_label
, which doesn’t include the method owner prefix.Anything you want to highlight for special attention from reviewers?
Thanks for your hard work 😄