Fixed menu not updating when a new sub section is added after rendering has already completed #2610
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Description
When a subsection is added to a menu section that has no subsections, the subsections won't appear if the component has already been rendered. To fix this we now not only check if new sections were added/removed, but also if the component that should be used to render that specific section has changed. This way the components will render again when we add a subsection to a section, because then the top level id still won't have changed, but the component that the top level sections should use to render will have.
Instructions for Reviewers
List of changes in this PR:
distinctUntilChanged(compareArraysUsingIds)check fromMenuComponenthas been moved toMenuService#getMenuTopSectionsMenuComponentthedistinctUntilChangedthat is responsible for setting the value ofsectionMap$now also checks it the component that should be renderd has changed.Guidance for how to test/review this PR:
HomeNewsComponent:/statistics) and refresh the pageCommunities & Collectionsshould have no subsection yetCommunities & CollectionsChecklist
yarn lintyarn check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.