Visitar URL original
`render_in`: Skip emission of `render_template.action_view` by joelhawksley · Pull Request #58805 · rails/rails · GitHub
Skip to content

render_in: Skip emission of render_template.action_view - #58805

Closed
joelhawksley wants to merge 2 commits into
rails:mainfrom
joelhawksley:joelhawksley-draft-pr-for-rails
Closed

joelhawksley wants to merge 2 commits into
rails:mainfrom
joelhawksley:joelhawksley-draft-pr-for-rails

Conversation

@joelhawksley

Copy link
Copy Markdown
Contributor

Related to #57781

As reported in #57781, new calls to #render_in emit render_template.action_view Active Support notifications, which themselves cause a spike in object allocations.

This commit explores an alternative that preserves the behavior introduced in #50623 (support for passing :locals at the #render_in call-site) without also emitting render_template.action_view notifications.

Rather than rely on the ActionView::Renderer instance returned by the ActionView::Helpers::RenderingHelper#view_renderer invocation, construct an instance of Template::Renderable and invoke #render on it directly.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Related to rails#57781

As reported in rails#57781, new calls to `#render_in` emit
`render_template.action_view` Active Support notifications, which
themselves cause a spike in object allocations.

This commit explores an alternative that preserves the behavior
introduced in [rails#50623][] (support for passing `:locals` at the
`#render_in` call-site) without also emitting
`render_template.action_view` notifications.

Rather than rely on the `ActionView::Renderer` instance returned by the
`ActionView::Helpers::RenderingHelper#view_renderer` invocation,
construct an instance of `Template::Renderable` and invoke `#render` on
it directly.

[rails#50623]: rails#50623
Bring in upstream JSON 3 compatibility fixes and the known guide-template skips while preserving Sean Doyle’s original commit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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