dia.Paper: add viewManagement option - #2974
Merged
Geliogabalus merged 52 commits intoAug 4, 2025
Merged
Conversation
kumilingus
force-pushed
the
paper-delayed-view-initialization
branch
from
June 17, 2025 17:19
e621cc1 to
cd2e459
Compare
kumilingus
force-pushed
the
paper-delayed-view-initialization
branch
2 times, most recently
from
July 1, 2025 10:36
38faec6 to
1f76b7d
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new viewManagement option to dia.Paper that enables advanced view lifecycle management with lazy initialization and optional disposal of hidden views. The primary purpose is to improve performance in scenarios with large numbers of cells by deferring view creation and potentially disposing views that are not visible.
Key changes include:
- Introduction of the
viewManagementoption withlazyInitializeanddisposeHiddensub-options - Replacement of the
viewportcallback with a newcellVisibilitycallback for better consistency - Implementation of a placeholder system for lazy view initialization
- Addition of view disposal logic when views become hidden
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/joint-core/src/dia/Paper.mjs |
Core implementation of view management features including placeholders, lazy initialization, and view disposal logic |
packages/joint-core/src/dia/LinkView.mjs |
Refactored to use lazy-loaded source/target views with caching and improved property getters |
packages/joint-core/src/mvc/ViewBase.mjs |
Added support for custom cid in constructor options |
packages/joint-core/src/mvc/View.mjs |
Deprecated view flags that moved to Paper |
packages/joint-core/src/dia/HighlighterView.mjs |
Added has() method to check for highlighter existence |
packages/joint-core/src/dia/CellView.mjs |
Added cell view marker for type identification |
packages/joint-core/src/alg/Deque.mjs |
New double-ended queue implementation for efficient view list management |
packages/joint-core/test/jointjs/dia/Paper.js |
Comprehensive tests for the new view management functionality |
packages/joint-core/test/jointjs/mvc.viewBase.js |
Tests for custom cid functionality |
packages/joint-core/test/jointjs/dia/HighlighterView.js |
Tests for the new has() method |
packages/joint-core/demo/performance/async.js |
Updated demo to use new cellVisibility option |
packages/joint-core/demo/performance/async.html |
UI improvements for the performance demo |
Comments suppressed due to low confidence (2)
kumilingus
marked this pull request as ready for review
August 4, 2025 11:27
Geliogabalus
approved these changes
Aug 4, 2025
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.
feat(dia.Paper) - add a new
viewManagementoption todia.Paperthat enables advanced view lifecycle management with lazy initialization and optional disposal of hidden views. The primary purpose is to improve performance in scenarios with large numbers of cells by deferring view creation and potentially disposing views that are not visible.viewManagementoption withlazyInitializeanddisposeHiddensub-optionsfeat(dia.Paper) - add
cellVisibility()callback option to support lazy view initializationviewportcallback withcellVisibilitycallbackfeat(dia.HighlighterView) - add static
has()method to check if a cell view has a highlighter attachedfeat(mvc.View) - custom
cidcan be provided via constructordemo - update
asyncdemo with theviewManagementoption