Skip to content

Updating state causes id already exists error #19

@silvercondor

Description

@silvercondor

Am I updating the state right?

this.state = {
    exampleGraph:{
        nodes: [],
        edges: []
    }
fetchState(){
    //api call with list of values
    this.setState({exampleGraph:{nodes: api_res.nodes, edges: api_res.edges})
}

Not the exact code but I'm doing something like this.

which gives me the following error

Error: Cannot add item: item with id 1 already exists

Stacktrace shows:

this.setState(
{ 
 exampleGraph: {nodes:node_list, edges: api_res_edges},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions