[LayerNext 2] Define attachment scopes and permanent layer disposal

オープン
#375 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

Start by reviewing graph.detachLayer(), React effect cleanup for both supported layer models, and the minimap's injected-style pattern. Trace attachment lifecycle handling across the graph, component construction, ports, subscriptions, and scheduled work before settling the public hook and cleanup-registration API. Done means attach/detach/reattach/disposal behavior is defined, all listed resources are released exactly once, StrictMode cleanup is leak-free, migration docs are updated, and existing consumer, strict, and CI checks pass.

索引モデルが issue の本文から書いたものです。

説明

Parent: #373. Status: deferred. Target branch: v2.

Dependency: #374.

Problem

The current graph.detachLayer() unregisters a layer and removes its DOM, but does not call the component's final unmount. React useLayer invokes this path on effect cleanup. The author-facing afterInit hook runs on every attachment, requires remembering base-hook calls, and cleanup of arbitrary DOM/style resources and scheduled work is easy to miss.

Scope

  • Give LayerNext explicit attach, reversible detach/reattach and permanent disposal semantics.
  • Invoke author hooks after derived construction is complete; do not call overridable initialization hooks from the base constructor.
  • Supply an attached hook context with a guaranteed root and valid declared resources. The engine manages its internal setup without requiring user super calls.
  • Allow attachment hooks to return/register cleanup for graph/DOM/signal subscriptions, temporary elements/styles and scheduled work. Run attach-scoped cleanup before reattachment and final disposal.
  • Add an explicit full-removal operation such as graph.removeLayer(layer): unregister, detach and dispose the component tree and instance-lifetime resources once. Retain a distinct temporary detach path.
  • Use full removal in React effect cleanup for both supported models, including StrictMode and rapid graph/layer replacement.

Acceptance criteria

  • Creation before graph attachment, attach/detach/reattach, repeated detach and repeated disposal have defined behavior.
  • Permanent removal releases children, ports, subscriptions, custom cleanup and scheduled tasks; a disposed instance cannot be reattached silently.
  • Reattachment installs listeners once and leaves no abandoned style elements or other attach-scoped DOM. Cover the minimap's current injected style pattern.
  • Explicit hide/show remains distinct from scale activation; resource and root readiness are accurate.
  • React cleanup and StrictMode do not leave registered layers or live resources behind.
  • Author lifecycle hooks require no super calls and never observe uninitialized derived fields.
  • Migration docs distinguish temporary detach, permanent removal and custom cleanup; existing strict/consumer/CI checks stay green.

Exact public hook names and cleanup registration syntax should be reviewed before implementation. This issue records intended semantics rather than locking an unfinished API.

主要言語
TypeScript
スター
145
フォーク
12
平均マージ
1日 14時間
マージ済み PR(30日)
43

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

gravity-ui/graph のほかの issue

gravity-ui/graph の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。