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
but by doing so, the html_options is mutated and key :class is removed. It could cause unexpected behavior in such examples:
<div><%html_options={class: "text-red-500",data: {some_stimulus_target: "target"}%> <%@elements.eachdo |element| %> <%=renderVitrail::Card.new(**html_options).with_content(element.content)%><!-- class is not passed after first element--><%end%></div>
In this case, after the first iteration, hash hold by html_options variable is mutated and :class key is remove.
I can see this method comes from Rails codebase but when it is done like, hash is cloned before being mutated.
In
Vitrail::BaseComponent
, initialize is:but by doing so, the
html_options
is mutated and key:class
is removed. It could cause unexpected behavior in such examples:In this case, after the first iteration, hash hold by
html_options
variable is mutated and:class
key is remove.I can see this method comes from Rails codebase but when it is done like, hash is cloned before being mutated.
Edit: I made a PR with a fix #4
The text was updated successfully, but these errors were encountered: