Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] node label cannot be updated when connected to an edge, after upgrading dash-cytoscape from 0.3.0 to 1.0.0 #214

Open
FredBill1 opened this issue Apr 10, 2024 · 0 comments

Comments

@FredBill1
Copy link

FredBill1 commented Apr 10, 2024

Description

After upgrading dash-cytoscape from 0.3.0 to 1.0.0, when trying to update the ["data"]["label"] of a node which is connected by an edge in a callback, the label stays unchanged unless we mannually remove and re-add the node from the elements of the Cytoscape component via two separate callbacks.

But if the node is not connected by an edge, it works as expected, which is pretty wierd.

Steps/Code to Reproduce

import dash_cytoscape as cyto
from dash import Dash, Input, Output, callback, html

@callback(Output("cytoscape", "elements"), Input("button", "n_clicks"))
def update_label(n_clicks):
    return [
        {"data": {"id": "1", "label": str(n_clicks)}},
        {"data": {"id": "2"}},
        {"data": {"source": "1", "target": "2"}},  # remove this line
    ]

app = Dash(__name__)
app.layout = html.Div([html.Button("Update", id="button"), cyto.Cytoscape(id="cytoscape")])

if __name__ == "__main__":
    app.run_server(debug=True)

Expected Results

The label of node with id="1" should be an integer that increases with the number of clicks of the button increases.

working

Actual Results

In version 0.3.0, it works as expected. But in version 1.0.0, the label of node with id="1" is freezed to be "None".

error

If we remove the edge connecting nodes with id="1" and id="2", it works again.

Versions

  • The bugged version:
Dash 2.16.1
Dash Cytoscape 1.0.0
  • The working version (running pip list shows dash-cytoscape 0.3.0, but dash_cytoscape.__version__ shows 0.2.0):
Dash 2.16.1
Dash Cytoscape 0.2.0
@FredBill1 FredBill1 changed the title [BUG] node label cannot be updated when connected to another node, after upgrading dash-cytoscape from 0.3.0 to 1.0.0 [BUG] node label cannot be updated when connected to an edge, after upgrading dash-cytoscape from 0.3.0 to 1.0.0 Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant