Skip to content

dia.Paper: add viewManagement option - #2974

Merged
Geliogabalus merged 52 commits into
clientIO:masterfrom
kumilingus:paper-delayed-view-initialization
Aug 4, 2025
Merged

dia.Paper: add viewManagement option#2974
Geliogabalus merged 52 commits into
clientIO:masterfrom
kumilingus:paper-delayed-view-initialization

Conversation

@kumilingus

@kumilingus kumilingus commented May 26, 2025

Copy link
Copy Markdown
Contributor
  • feat(dia.Paper) - add 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.

    • Implementation of a placeholder system for lazy view initialization
    • Introduction of the viewManagement option with lazyInitialize and disposeHidden sub-options
  • feat(dia.Paper) - add cellVisibility() callback option to support lazy view initialization

    • Replace the viewport callback with cellVisibility callback
  • feat(dia.HighlighterView) - add static has() method to check if a cell view has a highlighter attached

  • feat(mvc.View) - custom cid can be provided via constructor

  • demo - update async demo with the viewManagement option

@kumilingus
kumilingus force-pushed the paper-delayed-view-initialization branch from e621cc1 to cd2e459 Compare June 17, 2025 17:19
@kumilingus
kumilingus force-pushed the paper-delayed-view-initialization branch 2 times, most recently from 38faec6 to 1f76b7d Compare July 1, 2025 10:36
@kumilingus
kumilingus requested a review from Copilot July 4, 2025 16:26

This comment was marked as outdated.

@kumilingus
kumilingus requested a review from Copilot July 30, 2025 10:46

This comment was marked as outdated.

Comment thread packages/joint-core/src/dia/Paper.mjs Outdated
Comment thread packages/joint-core/types/joint.d.ts
@kumilingus
kumilingus requested a review from Copilot August 1, 2025 14:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 viewManagement option with lazyInitialize and disposeHidden sub-options
  • Replacement of the viewport callback with a new cellVisibility callback 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)

Comment thread packages/joint-core/src/dia/Paper.mjs
Comment thread packages/joint-core/src/dia/Paper.mjs
Comment thread packages/joint-core/test/jointjs/dia/Paper.js Outdated
@kumilingus
kumilingus marked this pull request as ready for review August 4, 2025 11:27
@Geliogabalus
Geliogabalus merged commit 1184173 into clientIO:master Aug 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants