Hi Guys,
I've encountered an issue with the Blazor starter kit (v 8.20). I am working with the e-commerce app. when I'm loading any page that loads the "js/custom/apps/ecommerce/catalog/save-category.js" file (Products.razor) for example, I'm facing an issue with the /plugins.bundle.js file. i would appreciate your help :)
details Error message:
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Cannot read properties of null (reading 'classList')
TypeError: Cannot read properties of null (reading 'classList')
at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14648
at Array.forEach (
the code I am using for the Product page:
@page "/ecommerce/catalog/products"
Product SKU Qty Price Rating Status Actions 03168001 Sold out 0 13 ScheduledActions 02131003 43 12 InactiveActions 04224007 24 28 ScheduledActions 04903007 Low stock 4 263 PublishedActions 04757001 Low stock 9 160 InactiveActions 01800009 Low stock 5 19 ScheduledActions 03245007 29 275 InactiveActions 04160003 Sold out 0 263 InactiveActions 02490004 19 171 ScheduledActions 01350009 Low stock 7 99 PublishedActions 01661004 13 299 PublishedActions 02190008 19 287 PublishedActions 02139009 24 161 PublishedActions 04708003 23 62 PublishedActions 01872009 Low stock 2 250 InactiveActions 04142009 14 266 ScheduledActions 01349005 41 240 ScheduledActions 01350005 11 241 PublishedActions 02341004 18 231 ScheduledActions 02494003 22 280 ScheduledActions 03436005 16 221 ScheduledActions 01409004 32 270 PublishedActions 02760005 41 170 InactiveActions 02589001 44 128 ScheduledActions 04337003 15 268 InactiveActions 01170009 Low stock 2 198 ScheduledActions 03627005 38 14 PublishedActions 01313003 20 277 ScheduledActions 04694007 Low stock 5 179 InactiveActions 03870006 Low stock 1 68 ScheduledActions 01270008 16 290 ScheduledActions 03530005 21 57 InactiveActions 03797007 Low stock 1 264 InactiveActions 01205006 36 146 PublishedActions 02345002 12 219 PublishedActions 04446009 31 238 InactiveActions 03861004 26 139 PublishedActions 04651004 27 257 ScheduledActions 02284002 46 288 InactiveActions 03245003 45 287 InactiveActions 04720002 Low stock 2 280 ScheduledActions 02442001 Low stock 6 161 PublishedActions 02846001 41 101 ScheduledActions 02732005 26 96 PublishedActions 04553006 Low stock 3 295 InactiveActions 01758004 Low stock 7 121 PublishedActions 04654008 41 64 InactiveActions 03347009 49 297 ScheduledActions 04661003 22 63 PublishedActions 02821002 43 87 PublishedActions @code { protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { // Add a small delay to ensure the JavaScript file is fully loaded await Task.Delay(500); await JS.InvokeVoidAsync("KTAppEcommerceCategories.init"); await JS.InvokeVoidAsync("KTAppEcommerceSaveCategory.init"); await JS.InvokeVoidAsync("KTAppEcommerceProducts.init"); await JS.InvokeVoidAsync("KTAppEcommerceSaveProduct.init"); } } }
Hi,
For the apps/ecommerce/catalog/products page, you do not need to include and initialize all of the eCommerce components.
Check the example in this gist.
You will need to load and initialize KTAppEcommerceCategories, KTAppEcommerceSaveCategory, and KTAppEcommerceSaveProduct on other eCommerce pages.
Regards,
Lauris Stepanovs,
Keenthemes Support Team