digitalmanufaktur / shopware6-manu-theme

Shopware 6 Theme
https://www.digitalmanufaktur.com/shopware-6-theme-manu/
42 stars 13 forks source link

JS Error on Shopware 6.4.10.0 TypeError: Cannot read properties of null (reading 'offsetWidth') #14

Open iMiMWeis opened 2 years ago

iMiMWeis commented 2 years ago

We are getting the following JS error:


plugin.manager.js?0b18:225 TypeError: Cannot read properties of null (reading 'offsetWidth')
    at InputSpinner.init (filter-width.plugin.js?0421:8:1)
    at InputSpinner._init (plugin.class.js?1462:56:1)
    at InputSpinner.Plugin (plugin.class.js?1462:29:1)
    at new InputSpinner (filter-width.plugin.js?0421:4:1)
    at Function._initializePluginOnElement (plugin.manager.js?0b18:337:1)
    at eval (plugin.manager.js?0b18:273:1)
    at Array.forEach (<anonymous>)
    at Function.iterate (iterator.helper.js?1116:39:1)
    at PluginManagerSingleton._initializePlugin (plugin.manager.js?0b18:272:1)
    at eval (plugin.manager.js?0b18:215:1)```
amenk commented 2 years ago

I am a colleague of @iMiMWeis

This happens for our shop also prior the update to the 6.4.10.0 which is not yet officially supported by Manu Theme.

It happens in Shopware 6.4.6.1, Manu Theme 2.0.3

We assume this is due to customzation to the theme.

It is happing on the main shop page where is no such .sorting input

Adding

if (this._sortBtn) {
   return;
}

after

https://github.com/digitalmanufaktur/shopware6-manu-theme/blob/c27eabe928b548a1c47398dd8e848adb6d760f62/src/Resources/app/storefront/src/js/filter-width/filter-width.plugin.js#L7

Would probably help, but I am not sure if this breaks something else? Shall we make a pull request?

Niklasliedtke commented 2 years ago

Hello all, we will take care about this bug very soon and release a new fixed version. Thanks for the patience.

amenk commented 2 years ago

@Niklasliedtke great, thanks :-)

OlliZabal commented 2 years ago

I had mentioned this sometime already before in issue #5 and it was closed by @Niklasliedtke Thanks @amenk for bringing this issue back up and for the quick fix - will give it a try.

Edit: in my case, this issue referres to the file \shopware6-manu-theme\src\Resources\app\storefront\dist\storefront\js\dmf-manu-theme.js and (this._sortBtn = document.querySelector(".sorting"))

amenk commented 2 years ago

I make a pull requests @Niklasliedtke or is there another / better fix?