From 23e8567e864137c833c03dfd383b9abb7c18db95 Mon Sep 17 00:00:00 2001 From: "PALIZ-DEVOPS\\ajr" Date: Wed, 12 Jul 2023 12:43:00 +0330 Subject: [PATCH] Using DynamicComponent Instead of RenderFragment in ContainerBuilder --- Oqtane.Client/UI/ContainerBuilder.razor | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Oqtane.Client/UI/ContainerBuilder.razor b/Oqtane.Client/UI/ContainerBuilder.razor index 9ed0d63b..15cc7fbc 100644 --- a/Oqtane.Client/UI/ContainerBuilder.razor +++ b/Oqtane.Client/UI/ContainerBuilder.razor @@ -9,12 +9,12 @@ @if (_useadminborder) {
- @DynamicComponent +
} else { - @DynamicComponent + } @@ -23,6 +23,7 @@ @code { private bool _visible = true; private bool _useadminborder = false; + public Type ComponentType { get; set; } [CascadingParameter] protected PageState PageState { get; set; } @@ -30,8 +31,6 @@ [Parameter] public Module ModuleState { get; set; } - RenderFragment DynamicComponent { get; set; } - protected override void OnInitialized() { ((INotifyPropertyChanged)SiteState.Properties).PropertyChanged += PropertyChanged; @@ -54,17 +53,7 @@ _useadminborder = false; } - DynamicComponent = builder => - { - Type containerType = Type.GetType(container); - if (containerType == null) - { - // fallback - containerType = Type.GetType(Constants.DefaultContainer); - } - builder.OpenComponent(0, containerType); - builder.CloseComponent(); - }; + ComponentType = Type.GetType(container) ?? Type.GetType(Constants.DefaultContainer); } private void PropertyChanged(object sender, PropertyChangedEventArgs e) @@ -83,4 +72,6 @@ { ((INotifyPropertyChanged)SiteState.Properties).PropertyChanged -= PropertyChanged; } + + }