[LayerNext 3] Make layer prop and presentation updates predictable

未关闭
#376 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
react, typescript
领域
frontend

调研方向

Start by reading the LayerNext implementation, the useLayer React integration, and the related strict-readiness work in #364 and #365. Identify how constructor resources, presentation props, graph/layer replacement, attach/detach cleanup, and consumer fixtures are structured before choosing signatures or reset semantics. Done means supported updates affect the existing live layer without resource recreation or duplicate subscriptions, immutable options are rejected or clearly unsupported, and source, packed consumer, runtime, and migration checks cover the stated lifecycle cases.

由索引模型根据 Issue 内容生成。

描述

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

Dependencies: #374, #375. Coordinate addon defaults with #364 and #365; do not duplicate their strict-readiness work.

Problem

A layer can receive setProps updates, but resources created in its constructor do not automatically reflect new classes, zIndex or dimensions. Some addons capture values only during construction. User props and Canvas creation options share an object even though their update capabilities differ.

Scope

  • Define a typed public updateProps(patch) operation for LayerNext that updates the existing instance.
  • Separate mutable user/presentation props from immutable resource creation options, such as 2D context attributes. Document unsupported mutations explicitly instead of silently ignoring them.
  • Define defaults, omitted/undefined values, object/array replacement and reset semantics before implementation. Reuse the established v2 settings policy where appropriate; do not invent a separate reset API without a demonstrated need.
  • Normalize defaulted values into complete runtime values while keeping consumer input partial/optional where appropriate.
  • Apply supported common presentation updates to the actual DOM/canvas and schedule redraws. Preserve declared resources and listeners during ordinary prop updates.
  • Ensure React useLayer updates the current live layer without recreating it or sending updates to a disposed/replaced instance.

Acceptance criteria

  • Source and packed consumer fixtures reject invalid patch keys/values and preserve custom generic prop inference.
  • Updating one prop preserves unrelated defaults and values; omitted and undefined values follow the documented policy.
  • Supported class/zIndex/size changes affect the existing elements and rendering, with no duplicated subscriptions or resource recreation.
  • Immutable creation options cannot appear to succeed while leaving the original resource unchanged.
  • React updates follow the active instance across graph/layer replacement and cleanup.
  • Runtime and consumer checks cover updates before attach, while attached and after detach; migration docs and strict checks remain current.

The exact update/reset signatures and list of mutable common options are design decisions for this future issue.

主要语言
TypeScript
星标
145
派生
12
平均合并
1 天 14 小时
30 天内合并 PR
43

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

gravity-ui/graph 的其他 Issue

查看 gravity-ui/graph 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。