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

Syncronize two-way updates between tops-storage and table.data #57

Open
mharty3 opened this issue Apr 24, 2021 · 3 comments
Open

Syncronize two-way updates between tops-storage and table.data #57

mharty3 opened this issue Apr 24, 2021 · 3 comments
Labels
bug Something isn't working CRITICAL CRITICAL FIX

Comments

@mharty3
Copy link
Collaborator

mharty3 commented Apr 24, 2021

Addresses #47 and #46.

The picks data in the table should be the same as the data in tops-storage and changes to one should update the other.

Currently, there is only one-way behavior: when picks are updated by clicking on the interactive plot, the changes are represented in the table. This is accomplished by the update_data_table() callback.

However, changes to the table (pick name, depth changes, pick deletions and additions) do not update tops-storage.

I tried solving this issue by adding table.data as an input to the update_pick_storage callback but this creates a "circular callback error" where changes to tops-storage trigger changes to table.data which triggers changes to tops-storage ... etc. I can't currently figure out how to get around that.

@mharty3 mharty3 added bug Something isn't working CRITICAL CRITICAL FIX labels Apr 24, 2021
@mharty3
Copy link
Collaborator Author

mharty3 commented Apr 24, 2021

I just spent a bit of time reading some dash documentation (big 🧠 idea), and I think I see now how to solve this issue.

There is a section on this page about circular callbacks. Circular callbacks are allowed if they are in the same callback. There are several examples on that page doing exactly what we need: keeping multiple outputs/inputs in sync.

Sounds like what we will need to do is consolidate the update_data_table() callback with the update_pick_storage() callback. So that one will have multiple outputs that will both be updated when there is a change to one or the other.

@mlbelobraydi
Copy link
Owner

Does that have the potential to break other functionality? It would probably be good to spin off most functions to another *.p to help organize some of the interactivity. That is a pretty big redesign of the code. I think that it would help with some of our errors too at startup.

@mharty3
Copy link
Collaborator Author

mharty3 commented Apr 24, 2021

If done right, it shouldn't break anything else. update_data_table() is a small callback and should be able to be rolled into update_pick_storage() without creating any issue. That way when any change to tops-storage or table.data happens, both the data storage and the table data are updated by the same callback.

I think it might be good for all the functions (except for callbacks) to be moved out of the app.py file. It will be a little cleaner to only have app initialization, layout, and callbacks in app.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CRITICAL CRITICAL FIX
Projects
None yet
Development

No branches or pull requests

2 participants