Repository navigation
Use store-widget for the Store panel's widget zones - #994
Merged
Merged
Conversation
added 3 commits
October 25, 2026 12:19
#922 dropped the theme's reference to Grand.Web and its `@addTagHelper *, Grand.Web`, so `<vc:...>` tags for components that live in Grand.Web stopped compiling into tag helpers. Razor emitted them as unknown HTML elements: the productdetails_* widget zones and the also-purchased/related/similar/recommended sections never ran, and the empty <vc:widget> elements took a full row inside .nordic-pd__main, pushing the product overview below the gallery. Component.InvokeAsync resolves the component at runtime, as the rest of the theme already does, so the theme keeps depending only on Grand.Web.Models.
…themes #922 removed `@addTagHelper *, Grand.Web` from plugin and theme _ViewImports and made a plugin reference to Grand.Web a build error. View-component tag helpers are generated per registered assembly, so <vc:widget> in any theme or plugin view compiled to a literal unknown element: its widget zones rendered nothing, with no build error. Every plugin and theme registers Grand.Web.Common, which is also an application part of the host, so the component works there for all of them. WidgetModel keeps its Grand.Web.Models.Cms namespace, which storefront and theme _ViewImports import, and the cache key moves to CacheKey. Nordic's widget zones go back to <vc:widget>; the product-list components still live in Grand.Web and stay invoked by name.
Eight Store panel views, copied from the Admin and Vendor panels, kept <vc:admin-widget> and <vc:vendor-widget>. Grand.Web.Store registers only its own assembly and Grand.Web.Common with @addTagHelper, so those tags compiled to literal unknown elements and the zones rendered no widgets. StoreWidget takes the same widgetZone and additionalData. ViewComponentTagTests checks every <vc:...> in the repository against the assemblies its view registers, since Razor reports no error for a tag it cannot resolve.
Base automatically changed from
fix/nordic-product-view-components
to
develop
October 25, 2026 13:39
| [TestClass] | ||
| public class ViewComponentTagTests | ||
| { | ||
| private static readonly string Src = Path.Combine(Installer.RepositoryPaths.Root, "src"); |
| var assemblies = new HashSet<string>(); | ||
| for (var dir = Path.GetDirectoryName(view); dir != null && dir.Length >= projectDir.Length; dir = Path.GetDirectoryName(dir)) | ||
| { | ||
| var imports = Path.Combine(dir, "_ViewImports.cshtml"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Stacked on #993: the new test also covers the
<vc:widget>tags that #993 fixes in the Nordic theme. Merge #993 first. This PR then retargets todevelop.Issue
Eight views in the Store owner panel (
Grand.Web.Store) were copied from the Admin and Vendor panels and still use<vc:admin-widget>(11 tags) or<vc:vendor-widget>(2 tags). Razor generates a<vc:...>tag helper only for the view components of assemblies that the view registers with@addTagHelper.Grand.Web.Storeregisters its own assembly andGrand.Web.Common, and it does not referenceGrand.Web.AdminorGrand.Web.Vendor. The compiledGrand.Web.Store.dllcontains tag helpers only forstore-widget,store-pageand the two bestseller reports. The 13 tags therefore reach the browser as empty unknown elements, so these widget zones never render a widget in the Store panel:Category/List.cshtml(category_list_buttons)Category/Partials/CreateOrUpdate.TabInfo.cshtmlProduct/List.cshtml(product_list_buttons)ProductAttributeCombination/AttributeCombinationPopup.cshtml(product_details_attribute_combination_buttons)Setting/Partials/Sales.TabLoyaltyPoints.cshtmlSetting/Partials/Sales.TabShoppingCart.cshtmlShared/Partials/UserFields.cshtmlHome/AccessDenied.cshtml(store_security_access_denied_top/_bottom, viavendor-widget)Razor reports no error or warning for a
<vc:...>tag it cannot resolve, which is how these and the Nordic theme's tags (#993) went unnoticed.Solution
<vc:store-widget>.StoreWidgetViewComponenttakes the samewidgetZoneandadditionalData, and the zone names are unchanged.Grand.Modules.Tests/Views/ViewComponentTagTests. For every<vc:...>in a.cshtmlundersrc, it finds the view component by class name or[ViewComponent(Name = ...)]and the project that declares it. It then checks that the_ViewImports.cshtmlchain of the project compiling the view registers that assembly with@addTagHelper. A second test pins the scan to known components, so a broken scan cannot pass silently.Without this fix, the test fails and lists exactly the 8 files above. With the fix, it passes.
Breaking changes
None. Plugins that render in these zones now appear in the Store panel as well as in Admin, as the views intended.
Testing
dotnet test src/Tests/Grand.Modules.Tests --filter ViewComponentTagTestspasses.<vc:admin-widget>and rerun the test. It fails and names that file.<vc:elements.