You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify render_preview + with_request_url behavior after 4.21.0 #2776
After upgrading from ViewComponent 4.19.0 to 4.21.0, we observed a change in URL generation when combining render_preview with with_request_url. For a component calling url_for(bar: 'baz'), rendering its preview inside with_request_url('/foo') now generates:
vc_test_request.path still returns /foo after rendering, even though the generated link points to the preview route. Replacing only render_preview with its implementation from v4.19.0 restores the previous result:
/foo?bar=baz
This appears to follow #2763, which creates an isolated preview request and replaces its controller, action, and preview path parameters before processing the action. The added test_render_preview_preserves_the_original_request_parameters covers this combination, but verifies that the original request remains unchanged rather than checking URL generation inside the preview. The documented with_request_url examples use render_inline.
Is this change in routing context intentional? Should with_request_url affect request-dependent URL generation inside render_preview? If the current behavior is intended, what is the recommended way to test request-dependent links using previews? Clarifying this interaction in the documentation would also help.
Activity
joelhawksley commentedon Nov 4, 2026
Thanks for the report. This was not an intentional change. I've fixed it in #2777.
yasaichi commentedon Nov 5, 2026
Thanks for the quick fix, @joelhawksley! I appreciate the regression tests and documentation too.