Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to treat content as a slot #2108

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BlakeWilliams
Copy link
Contributor

@BlakeWilliams BlakeWilliams commented Sep 29, 2024

Like discussed many times before, this adds content as a slot to
ViewComponent so that we can begin separating the block provided when
rendering from content for performance and ergonomic reasons.

This adds two new methods:

  • content_is_a_slot! - This makes the component and its descendants
    treat content as a slot, and the block provided to render calls is
    always executed
    .
  • do_not_use_content_as_a_slot! - This keeps the existing behavior
    where content is lazily evaluated and is used to return content.

There's likely more implications from this change that need to be walked
through (like how slots are used, and easily setting content) before
this can be merged.

Like discussed many times before, this finally adds content as a slot to
ViewComponent so that we can begin separating the block provided when
rendering from content for performance and ergonomic reasons.

This adds two new methods:

* `content_is_a_slot!` - This makes the component _and its descendants_
  treat `content` as a slot, and the block provided to render calls _is
  always executed_.
* `do_not_use_content_as_a_slot!` - This keeps the existing behavior
  where `content` is lazily evaluated and is used to return content.

There's likely more implications from this change that need to be walked
through (like how slots are used, and easily setting content) before
this can be merged.
@joelhawksley joelhawksley mentioned this pull request Oct 16, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant