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

Check if the type is a component before rendering #18783

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
@if (MenuItem.IsLeaf)
{
if (customComponentType != null)
if (customComponentType != null && typeof(ComponentBase).IsAssignableFrom(customComponentType))
{
<DynamicComponent Type="@customComponentType" />
}
Expand All @@ -32,7 +32,7 @@ else
{
<li class="nav-item">
<div class="dropdown">
@if (customComponentType != null)
@if (customComponentType != null && typeof(ComponentBase).IsAssignableFrom(customComponentType))
{
<DynamicComponent Type="@customComponentType" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
@if (MenuItem.IsLeaf)
{
if (customComponentType != null)
if (customComponentType != null && typeof(ComponentBase).IsAssignableFrom(customComponentType))
{
<DynamicComponent Type="@customComponentType" />
}
Expand All @@ -28,7 +28,7 @@
else
{
<div class="dropdown-submenu">
@if (customComponentType != null)
@if (customComponentType != null && typeof(ComponentBase).IsAssignableFrom(customComponentType))
{
<DynamicComponent Type="@customComponentType" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

if (menuItem.IsLeaf)
{
if (customComponentType != null)
if (customComponentType != null && typeof(ViewComponent).IsAssignableFrom(customComponentType))
{
@(await Component.InvokeAsync(customComponentType))
}
Expand All @@ -34,7 +34,7 @@
{
<li class="nav-item">
<div class="dropdown">
@if (customComponentType != null)
@if (customComponentType != null && typeof(ViewComponent).IsAssignableFrom(customComponentType))
{
@(await Component.InvokeAsync(customComponentType))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
@if (Model.IsLeaf)
{
if (customComponentType != null)
if (customComponentType != null && typeof(ViewComponent).IsAssignableFrom(customComponentType))
{
@(await Component.InvokeAsync(customComponentType))
}
Expand All @@ -31,10 +31,10 @@
else
{
<div class="dropdown-submenu">
@if (customComponentType != null)
{
@if (customComponentType != null && typeof(ViewComponent).IsAssignableFrom(customComponentType))
{

Check warning on line 35 in modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml

View check run for this annotation

Codecov / codecov/patch

modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml#L35

Added line #L35 was not covered by tests
@(await Component.InvokeAsync(customComponentType))
}
}

Check warning on line 37 in modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml

View check run for this annotation

Codecov / codecov/patch

modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/_MenuItem.cshtml#L37

Added line #L37 was not covered by tests
else
{
<a role="button" class="btn dropdown-toggle" data-bs-toggle="dropdown"
Expand Down