antvis / antvis/G6

[Feat]: More sophisticated way of managing states

Open
#6,872 0 comments 0 reactions 0 assignees View on GitHub
waiting for maintainer
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the feature / 功能描述

I'd like to add / remove a single state from a node.

Currently this could be done the following way:
```ts
graph.setElementState(node.id, [...node.states, add_state]);
graph.setElementState(node.id, node.states.filter(s => s !== rm_state));
```

The graph api could be improved by adding `graph.addState(node, state)` and `graph.removeState(node, state)`.

### Are you willing to contribute? / 是否愿意参与贡献?

✅ Yes / 是

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Graph API implementation and tests for setElementState, then review how node states are represented and updated. Done means the API supports adding or removing one state from a node and the relevant behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.