Skip to content

SSR silently fails on 'category/single' when root category exists in ES #3732

@cporte

Description

@cporte

Current behavior

When ES contains the root category and going directly to a page awaiting 'category/single' dispatch in asyncData method (e.g. category or product page), the promise is never resolved and the asyncData method never ends.

Expected behavior

The promise should always be resolved or rejected. I believe a else { resolve(mainCategory) } is missing after the if(sc.parent_id) in catalog/store/category/actions.ts, method Single, in the recursive dispatch single

Steps to reproduce the issue

Add the a category in ES with the ID of the root category and a null or 0 parent_id. Then go directly to a category page without using the internal routing.

Repository

Can you handle fixing this bug by yourself?

  • YES
  • NO

(I can definitely do a PR with the one line change, but considering the complexity of this code I might have missed a more elegant way of fixing this. We might for example want to reject if having the root category in ES is problematic somewhere else)

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: Tested on Vivaldi and Chrome
  • OS: Linux
  • Node: 10.16.3
  • Code Version: 1.10.4 (slightly modified, but modifications are not related to this bug)

Additional information

I use a custom backend, explaining why the root category was present. I believe this bug will not happen with usual backends, but if it can save a couple hours of debugging to the next customist, why not :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions