BUGFIX: Render RightSideBar components even if the sidebar is hidden #3537
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.
fixes: #1744
The problem
Peek.2023-06-24.09-53.1744.before.mp4
In #1744 @maltemuth figured out that the rendering of the
RightSideBarComponents
is prevented in case the side bar is hidden.Since the
<Tabs/>
component from@neos-project/react-ui-components
is responsible for tracking the open-tab-state, removing the component from the rendering tree inevitably leads to a reset of that state.The solution
Peek.2023-06-24.09-50.1744.after.mp4
I removed the condition, so that the
RightSideBarComponents
are now rendered regardless of the toggle-state of the side bar.Since this is technically a removal of code that was intended to be a performance optimization, I should probably address the potential performance impact:
I believe the idea was to save on the creation of React elements in case they're not actually visible to the user. While this sounds intuitively plausible, I would theorize that this actually hurts performance. Preventing the React elements from being created will cause ReactDOM to remove the DOM tree represented by those elements. When the side bar becomes visible again, the React elements will again be created, which leads ReactDOM to create an entirely new DOM tree from those elements.
If the creation of the React elements isn't prevented, ReactDOM probably won't do anything at all. It would therefore be a fair assumption that this change will lead to a slight performance improvement :)