[v2] Port additional CSS variable observation from PR #430
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
Línea de trabajo
Start in packages/graph-css-variables and read the current CSSVariablesLayerProps implementation and observer tests, then compare the reviewed behavior in PR #430. Add coverage for custom variable reads, updates, subscription changes, and equal-list updates; the issue also names apps/storybook/src/stories/plugins/cssVariables for the example. Done means the listed unit and browser cases, package documentation, and declarations meet the acceptance criteria.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Goal
Port the additionalCSSVariables capability from #430 to the v2 branch so applications can observe their own CSS variables and use onChange to update custom graph components, such as group colors.
The target is @gravity-ui/graph-css-variables (packages/graph-css-variables), extracted in #402. Adapt the final reviewed behavior of #430 to the current v2 implementation.
Scope
- Add
additionalCSSVariablesto the publicCSSVariablesLayerProps. - Observe custom names alongside built-in variables, including initial reads and subsequent change notifications.
- Report custom values through
onChange; keep built-in graph color/constant mappings unchanged. Custom-only updates must not callgraph.setColors()orgraph.setConstants(). - Support replacing and clearing the list: newly added names become observable, removed names stop producing notifications, and unregistered names are filtered out.
- Apply subscription changes using the updated props and clean up the previous observation correctly.
- Preserve v2's proxy-based observation, unset-value handling, and
oldValuetracking. Cover variables that are initially unset and become defined later. - Keep the implementation and public exports in
graph-css-variables, with React usage through@gravity-ui/graph-react.
Carry over the notification-loop fix
The version of #430 reviewed at e0cf28109b70e9cff10d36ea8a6a2f5a2d9182bb compares the additional-variable array by reference. An inline array combined with a callback that updates React state causes repeated observer restarts and initial notifications while CSS remains unchanged.
See the confirmed reproduction and minimal fix.
Compare the variable list by contents, treating an omitted list as empty; the existing lodash/isEqual dependency is sufficient for the minimal fix. Replacing the list with an equal array must not restart observation or emit another initial notification.
Acceptance criteria
- Unit tests cover initial custom values, subsequent changes, built-in mapping preservation, filtering, list replacement/clearing, and cleanup.
- A regression test covers an equal new array and a React consumer with inline
additionalCSSVariablesand anonChangecallback that stores the received records in state. Notifications settle after the initial read and resume only for actual value or subscription changes. - Browser coverage with the real observer verifies custom-variable updates and the initially-unset → defined transition without regressing v2's existing unset-value behavior.
- Port the custom-variable Storybook example to
apps/storybook/src/stories/plugins/cssVariables, using v2 package imports. Changing the variable updates the existing group's color without replacing its component. - Update the package documentation and verify that the public prop is available through the published package declarations.
- The affected package's type checks, lint, tests, and relevant package-contract checks pass.
- Lenguaje dominante
- TypeScript
- Estrellas
- 145
- Forks
- 12
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 43
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de gravity-ui/graph
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
gravity-ui/graph#457 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
gravity-ui/graph#455 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
gravity-ui/graph#456 ·
Los mantenedores suelen responder en 1 día
-
proposal
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
gravity-ui/graph#416 ·
Los mantenedores suelen responder en 1 día
-
Graph root is not a containing block for absolutely positioned layersPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
gravity-ui/graph#414 ·
Los mantenedores suelen responder en 1 día
Todos los issues de gravity-ui/graph
Issues similares
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openclaw/openclaw#199885 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
feature needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
sequant-io/sequant#1689 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100