Reaction: [Marketplace] Setting a Brand Asset results in error

Created on 30 Sep 2017  路  5Comments  路  Source: reactioncommerce/reaction

On latest marketplace, setting a brand Image will make the whole cleint ui unusable.
The console throws: TypeError: Cannot read property 'getShop' of undefined
The error seems to be in this part of /core/ui/client/containers/navbar.js: (L21-24)

  if (shop && Array.isArray(shop.brandAssets)) {
    const brandAsset = _.find(this.getShop().brandAssets, (asset) => asset.type === "navbarBrandImage");
    brandMedia = Media.findOne(brandAsset.mediaId);
  } 
bug

Most helpful comment

Yes, the PR does exactly what I described in the first comment. Closing this as it's fixed :)

All 5 comments

the getShop()function doesn't exist anymore in navbar.js.
this.getShop() can simply be replaced with shop, as there is a var "shop" defined now, which will have the same value that getShop() returned.

@janus-reith we tried to reproduce on the marketplace as of today.. couldn't. If you can, can you add steps to reproduce?

Weird, will try to clone the repo again and try without modifications - Although there were no New commits changing that file.
In imports/plugins/core/ui-navbar/client/containers/navbar.js there is the line const brandAsset = _.find(this.getShop().brandAssets, [...]
getShop is nowhere defined in that file.

@janus-reith can you confirm that #3030 resolves this?

Yes, the PR does exactly what I described in the first comment. Closing this as it's fixed :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spencern picture spencern  路  3Comments

mikemurray picture mikemurray  路  4Comments

jeffcorpuz picture jeffcorpuz  路  3Comments

ajporlante picture ajporlante  路  4Comments

spencern picture spencern  路  4Comments