vtex-apps/condition-layout

Cannot read propery 'find' of undefined at categoryTree

razvanudream opened this issue · 1 comments

Describe the bug
After using the migration guide to migrate from 1.x to 2.x I ran into the following error when using categoryTree in the subject (it works with any other subject, but not categoryTree

Here's a code snippet without the flex-layout components so you can check the structure:
"condition-layout.product#prc":{ "props": { "conditions": [ { "subject": "categoryTree", "arguments": {"id": "1000013"} } ], "Then": "flex-layout.row#prc-eol", "Else": "condition-layout.product#custom-consignatie" } }, "condition-layout.product#custom-consignatie":{ "props": { "conditions": [ { "subject": "categoryTree", "arguments": {"id": "1000007"} } ], "Then": "flex-layout.row#prc-consignatie", "Else": "condition-layout.product#custom-cursuri" } }, "condition-layout.product#custom-cursuri": { "props": { "conditions": [ { "subject": "categoryTree", "arguments": {"id": "1000008"} } ], "Then": "flex-layout.row#prc-cursuri", "Else": "flex-layout.row#prc" } },

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade version to 2.x in manifest
  2. Create a condition-layout.product with subject categoryTree
  3. At this point you should be seeing the error. The id's are all valid as this is just a migration, nothing new is actually added, just re-writing the code so it works with 2.x.

Expected behavior
It shouldn't throw the error when using categoryTree

Screenshots
image

Desktop environment:
`npx: installed 1 in 1.303s

System:
OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Memory: 414.08 MB / 7.62 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.15.1 - /usr/bin/node
npm: 6.14.8 - /usr/bin/npm
Browsers:
Chrome: 87.0.4280.66
Firefox: 83.0`

Problem isn't browser specific. It's the same in Chrome, Firefox, etc.

Closed as it's been fixed in #33