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
This is related to the HTML escaping conversations, but we should use the format method to correctly indicate the type of content that the component is generating, especially since that may be utilized by rails/rails#50623.
This is likely a breaking change, but I propose that we:
Stop using variant as the format return value
Implement some reasonable defaults, e.g. default to html for .html.erb, JSON for .jbuilder, etc.
Document format as being overridable when necessary
When implementing the call method without also implementing format, warn that we will default to HTML and escape.
The text was updated successfully, but these errors were encountered:
In that PR's current state, I don't think there's any change to the significance of the #render_in object defining a #format method. That method pre-dated that PR, and was actually an implicit requirement of the interface. rails/rails#50622 documented that requirement to be explicit, and also made it optional.
@seanpdoyle 👋 thanks for commenting here too and sharing context!
I imagine we still want to make this change since the current behavior isn't exactly correct, and we'll get some benefits from implementing it. Right now I don't think format is reliable, and I don't imagine it gets much use outside of framework internals so I feel like it's a very small breaking change either way.
@BlakeWilliams@seanpdoyle I believe the request.format method is a more reliable way to get the format. It doesn't Make much sense to me to use a json format for example in an html request
This is related to the HTML escaping conversations, but we should use the
format
method to correctly indicate the type of content that the component is generating, especially since that may be utilized by rails/rails#50623.This is likely a breaking change, but I propose that we:
.html.erb
, JSON for.jbuilder
, etc.format
as being overridable when necessarycall
method without also implementingformat
, warn that we will default to HTML and escape.The text was updated successfully, but these errors were encountered: