-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove shortcut to data checking and substitute with a rough hash #10125
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
Conversation
|
I think the PR only fixes the case if the incoming data changes via If I run this example, it is not updating the chart for me when clicking on "change": import pandas as pd
import streamlit as st
data1 = {"VALUE": [420, 380, 390], "DATE": [50, 60, 70]}
data = pd.DataFrame(data1)
data2 = {
"VALUE": [420, 380, 600, 390],
"DATE": [50, 60, 70, 80],
}
if st.button(label="change"):
data = pd.DataFrame(data2)
st.dataframe(data)
st.vega_lite_chart(
data=data,
spec={
"autosize": {
"type": "fit",
"contains": "padding",
"resize": True,
},
"title": "test",
"layer": [
{
"layer": [
{
"mark": "line",
},
],
"encoding": {
"x": {
"field": "DATE",
"title": "",
"type": "quantitative",
},
"y": {
"field": "VALUE",
"title": "",
"type": "quantitative",
},
},
},
],
},
use_container_width=True,
theme="streamlit",
)I think we can entirely remove the if (prevData.hash !== data.hash) {
view.data(name, getDataArray(data))
}One option could be a hash calculated in the backend for the full bytes (as you have proposed before) or a more lightweight "hash" prototyped here (that's not perfect but probably more reliable than the current version): #10139 I think we could start with the lightweight hash and eventually replace it with a backend-calculated hash since it might also be needed for lazy-loading. |
1b0afdb to
e2a2f1b
Compare
st.add_rows
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
|
||
|
|
||
| def test_vega_lite_chart_updates_with_slightly_different_data( | ||
| themed_app: Page, assert_snapshot: ImageCompareFunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can probably use app instead of themed_app to lower the number of snapshots (since the behavior doesn't really depend on theming).
…reamlit#10125) ## Describe your changes We have a shortcut included to guess if the data is an extension of the original data. This has caused issues in ensuring the data works as expected. We want to make sure we only do this if the data is newly added. ## GitHub Issue Link (if applicable) Closes streamlit#6689 ## Testing Plan - Manual testing for the following: - add rows triggers an insert and not a new data - The same data does not update the data. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Describe your changes
We have a shortcut included to guess if the data is an extension of the original data. This has caused issues in ensuring the data works as expected. We want to make sure we only do this if the data is newly added.
GitHub Issue Link (if applicable)
Closes #6689
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.