Skip to content

SearchPanel Invalid attempt to spread non-iterable instance #3758

@tdugue

Description

@tdugue

Current behavior

when I do a search I have this error :

TypeError: Invalid attempt to spread non-iterable instance
    at _nonIterableSpread (vsf-search-panel.5d5b39b5d74683045a5f.hot-update.js:20)
    at _toConsumableArray (vsf-search-panel.5d5b39b5d74683045a5f.hot-update.js:18)
    at SearchPanel.vue:122
    at Array.forEach (<anonymous>)
    at VueComponent.categories (SearchPanel.vue:116)
    at Watcher.get (vue.runtime.esm.js:4473)
    at Watcher.evaluate (vue.runtime.esm.js:4578)
    at VueComponent.computedGetter [as categories] (vue.runtime.esm.js:4830)
    at Object.get (vue.runtime.esm.js:2072)
    at Proxy.render (SearchPanel.vue?d4a6:75)

the problem is that if a product is in any category this code is not working :

        [...product.category].forEach(category => {
          categoriesMap[category.category_id] = category
        })

it's normal because product.category is undefined.

we need to implement this verification I think :

     if (product.category) {
          [...product.category].forEach(category => {
            categoriesMap[category.category_id] = category
          })
        }

Thanks

Expected behavior

Steps to reproduce the issue

Repository

Can you handle fixing this bug by yourself?

  • YES
  • NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

  • Browser: Chrome Version 72.0.3626.81 (Build officiel) (64 bits)
  • OS: Debian GNU/Linux 9.9
  • Node: v10.16.3
  • Code Version: v1.10.4

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: ImportantPriority mark - still high ;)bugBug reports

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions