[LayerNext 3] Make layer prop and presentation updates predictable

Aperta
#376 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
145
Fork
12
Merge medio
1g 14h
PR unite (30g)
43

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di gravity-ui/graph

Tutte le issue di gravity-ui/graph

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.