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 could be a breaking change, but we'd want to include a way of opting into the legacy behavior for at least 1 version to make the migration easier.
I propose that we:
Implement content_is_a_slot! method to allow components in this version of ViewComponent to opt-in to the new behavior as well as break inheritance of the method mentioned below once we release 4.0.
Implement a legacy_content_behavior! (or better named) method that can be called in components (and inherited) to opt-in to the current behavior. This would be a noop until 4.0.
Now in 4.0 or when content_is_a_slot! is declared, when components are passed a block the resulting HTML and string values are not passed as #content and the block is always evaluated (unlike today). To pass content, c.content do will need to be called in the block or via the change mentioned below.
Update with_content to support being passed a block, so existing components that rely on the default content behavior (without calling slots) can migrate via render(MyComponent.new) { "hi!" } -> render(MyComponent.new).with_content { "hi" }.
The text was updated successfully, but these errors were encountered:
This could be a breaking change, but we'd want to include a way of opting into the legacy behavior for at least 1 version to make the migration easier.
I propose that we:
content_is_a_slot!
method to allow components in this version of ViewComponent to opt-in to the new behavior as well as break inheritance of the method mentioned below once we release 4.0.legacy_content_behavior!
(or better named) method that can be called in components (and inherited) to opt-in to the current behavior. This would be a noop until 4.0.content_is_a_slot!
is declared, when components are passed a block the resulting HTML and string values are not passed as#content
and the block is always evaluated (unlike today). To pass content,c.content do
will need to be called in the block or via the change mentioned below.with_content
to support being passed a block, so existing components that rely on the default content behavior (without calling slots) can migrate viarender(MyComponent.new) { "hi!" }
->render(MyComponent.new).with_content { "hi" }
.The text was updated successfully, but these errors were encountered: