-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
Blazor layout sections #28660
Blazor layout sections #28660
Conversation
@surayya-MS ... I'm holding off on publishing this until Preview 3 is released, but do you want to review it now? |
@surayya-MS can you please review this when you get time? Thanks! |
Surayya ... The revisions are in place, except for one aspect ...
Could you flesh that bit out further for the topic? What you do want to tell devs about the approach? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @guardrex !
Yes, I described here #28660 (comment) |
@surayya-MS What happens if you define a Also, is there ever a case where you'd use a |
That works great, so shall we make this it's own topic under the Components node and call it "ASP.NET Core Blazor sections" and not refer to "layouts," just call this feature "sections" throughout? I have a follow-up question on casing: I know the dev can do whatever they want on casing, but what should we show for the argument format? Usually, we go with camel ( btw -- Being a silly 🦖, I don't know anything about framework design, but it seems like "outlet" isn't necessary or particularly helpful. When I first saw this, I wondered why not simplify to Example of non-layout use:
<h3>Child</h3>
<p>Hello from the Child!</p>
<SectionContent SectionName="parentOutlet">
Content provided by Child for 'parentOutlet' in Parent.
</SectionContent>
@page "/parent"
<h3>Parent</h3>
<p>Hello from the Parent!</p>
<div class="border border-info rounded-pill p-2">
<SectionOutlet SectionName="parentOutlet" />
</div>
<Child /> Output: |
Nothing happens. |
Yes, there is. Thanks @guardrex for providing an example for this case. |
I think @danroth27 will say we should have a topic for this in the Components node to avoid extending the already too long overview topic, but I'll wait to confirm it before setting this up that way. Also, should we show camel or Pascal case as the example for the name? I know devs can do whatever they want, but I think we should pitch our example(s) one way. ... and just asking out of curiosity @surayya-MS, was just |
I think it is a good idea! We should also put a link to sections in layouts docs as the main use case for sections was to change layouts. |
@surayya-MS I'm seeing some errors when I try this out with .NET 8 Preview 3. If I create a System.InvalidOperationException: There is already a subscriber to the content with the given section ID 'IndexSection'. |
For |
Sounds reasonable to me. I think we should still also mention sections in the layouts topic because that still is a common use case.
We could also use kebab-casing. That's what's often used for HTML IDs. @surayya-MS Thoughts? |
Yes, I think kebab-case is better. @guardrex please ignore my previous comment where I said:
Let's use kebab-case for |
Latest commits ... Add the following lines ...
Moves the content to a new article ... Title: ASP.NET Core Blazor sections Has a versioned Sections section in the layout article linking to the new article ...
|
@danroth27 this is strange behavior. I just tried it in the Samples/BlazorServerApp and there were no errors. What is happening probably is that you have Could you please confirm if this is true? |
|
@danroth27 @surayya-MS ... You're still discussing the ..... er .... 👽 strange behavior 🛸😄 ... but is the PR ready to merge? |
I think it is. @danroth27 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #28617
Surayya ... Note that I don't get access to the bits until the preview releases, so I can't check/test anything locally at this time. I had to guess a little on a few of the finer points, but you'll likely spot anywhere I went wrong 🙈 quickly.
UPDATE: I reacted to the latest design changes coming for Preview 3. Given that I did that here, it seems like we should hold this until the Preview 3 release. However, I think we can go ahead and get it reviewed and updated.
Internal previews