cengage / react-magma

https://react-magma.cengage.com
MIT License
21 stars 12 forks source link

TreeView: Children of preselected items don't get updated as expected #1433

Open silvalaura opened 1 week ago

silvalaura commented 1 week ago

Describe the bug

image

pt1ch1.1 should be selected even though it’s not in the list of preselected (because it’s the child of a preselected item), but it should also appear on the list of tags and count of tags

To Reproduce Steps to reproduce the behavior:

  1. Go to https://storybook-preview-dev--upbeat-sinoussi-f675aa.netlify.app/?path=/story/treeview--complex
  2. Notice the list of preselectedItems:
    preselectedItems: [
    { itemId: 'pt1ch1', checkedStatus: IndeterminateCheckboxStatus.checked },
    { itemId: 'pt1', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
    { itemId: 'pt2ch4', checkedStatus: IndeterminateCheckboxStatus.checked },
    {
      itemId: 'pt2ch5.1.1',
      checkedStatus: IndeterminateCheckboxStatus.checked,
    },
    { itemId: 'pt2ch5.2', checkedStatus: IndeterminateCheckboxStatus.checked },
    { itemId: 'pt2ch5.3', checkedStatus: IndeterminateCheckboxStatus.checked },
    ],
  3. Notice that pt1ch1.1 is selected even though it's not listed in the array below. This is expected behavior because it's a child of a selected item
  4. Also notice that in the tags below, pt1ch1.1 does not appear
  5. This is also causing the tag total number to be in correct. This example should have 10 tags

Expected behavior

silvalaura commented 6 days ago

This will be indirectly fixed by @vitaliirumiantsev-cengage in #1446