lrud icon indicating copy to clipboard operation
lrud copied to clipboard

insertTree: Maintain active children if requested

Open EwanRoycroft opened this issue 3 years ago • 0 comments

Description

Adds the maintainActiveChildren option to insertTree(). If enabled, any active children specified in the subTreeRootNodeConfig will be assigned once the tree is registered.

Motivation and Context

I have a use-case where I want to cache a tree and then restore it at a later date. When I do so, I need the tree to maintain any previously-activated children so the page layout is maintained. I do not want to trigger an activeChild event, I need the children to be silently re-activated as the tree is re-registered.

How Has This Been Tested?

I have an example of this code running in the demo for bbc/react-lrud-cache-route. All existing jest tests pass.

I have defaulted the maintainActiveChildren to false so it will not affect any current users of this library.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

EwanRoycroft avatar May 31 '22 15:05 EwanRoycroft