Repository navigation
perf(web): pool and reuse layout components across layout transitions - #904
Merged
Merged
Conversation
Prevent recreation of expensive components (Timeline, Logs, History, Graph) when switching layouts from the header menu or shortcuts. LayoutService now detaches and pools ComponentRef instances, cleanly reattaching their DOM elements when the new layout loads. This preserves the WebGL context, shaders, and histogram calculations for immediate restoration without lag. Surplus instances (e.g. extra timelines) are cleanly destroyed upon layout load.
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
August 26, 2026 01:22
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces component pooling and caching in LayoutService to reuse Angular components (such as Timeline, Log, History, and Graph) when switching layouts, accompanied by comprehensive unit tests. The reviewer provided valuable feedback, suggesting to detach change detection for pooled components to avoid unnecessary CPU overhead, and to wrap DOM-manipulating test cases in try...finally blocks to ensure proper cleanup even upon test failures.
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.
Summary
Prevent recreation of expensive components (Timeline, Logs, History, Graph) when switching layouts from the header menu or shortcuts (
Ctrl+1,Ctrl+2,Ctrl+3).Changes
ComponentRefinstances on layout change, cleanly reattaching their DOM elements into new GoldenLayout containers within the same JS execution frame.ComponentRef.destroy()) components on explicit tab close ('x').layout.service.spec.tsunit tests verifying reuse, surplus destruction, and lifecycle disposal onngOnDestroy.Verification
make test-web(766/766 passed)make lint-web(0 errors)make format-webmake build-storybookmake pre-commit