danheron / Heron.MudCalendar

Calendar component for MudBlazor
MIT License
174 stars 33 forks source link

Inserting MudCalendar overrides <HeadContent> #61

Closed traseedarkwatch closed 1 year ago

traseedarkwatch commented 1 year ago

I have a dynamic application that relies on using HeadContent for dynamic meta and styling information. When inserting (with no parameters specified) onto a page, my dynamic HeadContent gets overwritten. I'm assuming this is because MudCalendar is using HeadContent to inject it's CSS/Scripts. HeadContent is not additive. The last call to HeadContent will always override what's in there previously.

To reproduce, create a page using Add to the page Notice that the HeadContent is overwritten.

traseedarkwatch commented 1 year ago

Looking through the code, I notice that you are setting the HeadContent in MudCalendar.razor, line 12

    /// <summary>
    /// Renders the html page head element.
    /// </summary>
    protected virtual RenderFragment RenderHead =>
        @<HeadContent>
            @RenderHeaderContent
        </HeadContent>;

Could you add a parameter to make that declaration optional, knowing that the _Host.cshtml file would need to be updated with the CSS and Script manually?

danheron commented 1 year ago

I didn't realise that HeadContent will overwrite, I just assumed it would append. That's not good.

I will see if there is another way to do this. If not then I'll have to remove it.