Repository navigation
[6.x] Remove architectural lines when leaving a navigation page - #15681
Merged
Merged
Conversation
- The tree callbacks toggle the lines from methods, where toggleArchitecturalBackground's onUnmounted has no component to attach to, so leaving an empty nav left the lines on the next page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the Problem
If you open a navigation with no items and then go somewhere else in the CP, the architectural lines background follows you. For example, it shows up behind the Collections list, and behind the Pages tree.
The navigation page turns the lines on and off from its tree callbacks, which call
toggleArchitecturalBackground(). That helper relies ononUnmounted()to clean up, but these calls happen in methods, not insetup, so there's no component foronUnmounted()to attach to. The cleanup never gets registered and the class stays on the content card.What this PR Does
Adds an
unmounted()hook to the navigation page that turns the lines off when you leave.I've kept the fix in the page rather than changing the helper. The helper can't clean up after a caller it isn't attached to, and making it skip
onUnmounted()outsidesetupwould only hide the dev warning that points at this kind of leak. The page is the one turning the lines on, so it should be the one turning them off.This also means the
:not(:has(.page-tree-branch))guard onbg-architectural-linesisn't needed any more, so #15679 can drop it.Before / After
How to Reproduce