Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Cannot read properties of null (reading 'classList') in plugins.bundle.js

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 () at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14625 at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14765 at Array.forEach () at classSet (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14570) at i.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26267:1236) at t.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26279:1503) at e.registerPlugin (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:3035) at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:17181 Microsoft.JSInterop.JSException: 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 () at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14625 at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14765 at Array.forEach () at classSet (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14570) at i.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26267:1236) at t.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26279:1503) at e.registerPlugin (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:3035) at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:17181 at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at Starterkit.apps.ecommerce.catalog.EditProduct.OnAfterRenderAsync(Boolean firstRender) in /Users/newmacbookpro/Desktop/client_app/Starterkit/apps/ecommerce/catalog/EditProduct.razor:line 1903 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111] Unhandled exception in circuit 'k0QEvhu1Zl_UhgWtCuaT_zPsStLL86yWP9OwVakflC8'. Microsoft.JSInterop.JSException: 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 () at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14625 at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14765 at Array.forEach () at classSet (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:14570) at i.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26267:1236) at t.install (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26279:1503) at e.registerPlugin (http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:3035) at http://localhost:5070/assets/plugins/global/plugins.bundle.js:26258:17181 at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at Starterkit.apps.ecommerce.catalog.EditProduct.OnAfterRenderAsync(Boolean firstRender) in /Users/newmacbookpro/Desktop/client_app/Starterkit/apps/ecommerce/catalog/EditProduct.razor:line 1903 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

the code I am using for the Product page:

@page "/ecommerce/catalog/products"

Add Product
Product SKU Qty Price Rating Status Actions
03168001 Sold out 0 13
Scheduled
Actions
02131003 43 12
Inactive
Actions
04224007 24 28
Scheduled
Actions
04903007 Low stock 4 263
Published
Actions
04757001 Low stock 9 160
Inactive
Actions
01800009 Low stock 5 19
Scheduled
Actions
03245007 29 275
Inactive
Actions
04160003 Sold out 0 263
Inactive
Actions
02490004 19 171
Scheduled
Actions
01350009 Low stock 7 99
Published
Actions
01661004 13 299
Published
Actions
02190008 19 287
Published
Actions
02139009 24 161
Published
Actions
04708003 23 62
Published
Actions
01872009 Low stock 2 250
Inactive
Actions
04142009 14 266
Scheduled
Actions
01349005 41 240
Scheduled
Actions
01350005 11 241
Published
Actions
02341004 18 231
Scheduled
Actions
02494003 22 280
Scheduled
Actions
03436005 16 221
Scheduled
Actions
01409004 32 270
Published
Actions
02760005 41 170
Inactive
Actions
02589001 44 128
Scheduled
Actions
04337003 15 268
Inactive
Actions
01170009 Low stock 2 198
Scheduled
Actions
03627005 38 14
Published
Actions
01313003 20 277
Scheduled
Actions
04694007 Low stock 5 179
Inactive
Actions
03870006 Low stock 1 68
Scheduled
Actions
01270008 16 290
Scheduled
Actions
03530005 21 57
Inactive
Actions
03797007 Low stock 1 264
Inactive
Actions
01205006 36 146
Published
Actions
02345002 12 219
Published
Actions
04446009 31 238
Inactive
Actions
03861004 26 139
Published
Actions
04651004 27 257
Scheduled
Actions
02284002 46 288
Inactive
Actions
03245003 45 287
Inactive
Actions
04720002 Low stock 2 280
Scheduled
Actions
02442001 Low stock 6 161
Published
Actions
02846001 41 101
Scheduled
Actions
02732005 26 96
Published
Actions
04553006 Low stock 3 295
Inactive
Actions
01758004 Low stock 7 121
Published
Actions
04654008 41 64
Inactive
Actions
03347009 49 297
Scheduled
Actions
04661003 22 63
Published
Actions
02821002 43 87
Published
Actions

@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"); } } }

Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(