woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.22k stars 10.74k forks source link

Analytics Screen crashes when no parent category is found using getCategoryAncestorIds() in React #35822

Open kaushikasomaiya opened 1 year ago

kaushikasomaiya commented 1 year ago

Prerequisites

Describe the bug

5758575-zen 5750343-zen https://wordpress.org/support/topic/woocommerce-analytics-error-after-clicking-products-and-categories-reports/#post-16235153

When the parent category is not found in database - Analytics screen for Products and Category crashes with the following error in console:

https://d.pr/i/8MoByJ Full Size: https://d.pr/i/8MoByJ

Expected behavior

Screen should not crash

Actual behavior

Screen crashes

Steps to reproduce

Not sure how to replicate this, but one way to do is:

  1. Create parent and child categories
  2. Assign child to a product and buy that product so that it appears in Analytics > Products, and Analytics > Categories
  3. Delete the parent category row from DB directly in _term_taxonomy and _terms
  4. Refresh Analytics screen and see the same issue

 

WordPress Environment

NA

Isolating the problem

manpreet521991 commented 1 year ago

Hi, thank you for posting here. I am having the same issue. Could you please tell me the solution to it?