Implement it the same way storing in hidden divs worked: using a callback retrieve localStorage contents as State, manipulate the data, and save. The default āclick countā demo in the documentation illustrates how to read and update values stored in local/session/memory. Should be easy to extend to a updating a list of values or dict of list of values.
You can also use State('store-element', 'modified_timestamp') as a lookup for querying new data. Believe the modified timestamp is given as epoch time in milliseconds.
This is a HUGE improvement over the hidden div method. Much appreciated. However, I wanted to verify one point: the Store method will incur the same network transport costs as a hidden div, right? In other words, I will still likely want to cache (memoize) very large files?
Just getting into Dashā¦ so far Iām finding it lets me develop better data visualisation GUIs in a fraction of the time it used to take me (with matlab or IDL) despite the fact that Iām just starting up the learning curve. So, thanks!
Are there any dreams or possibilities to get this going without the overhead of passing the data through a string datatype at some point in the future? Or maybe there is a keyword/flag that Iām missing and it already does this somehow?
Itās much cleaner to have all that hidden div stuff outside of my program, but the fact that it still happens under the hood makes a big difference. In my case (started using larger data sets) I started using a store to keep a downsized copy of a downsampled/averaged portion of data Iām actually visualising. This made it possible for the code to actually executeā¦ but a variety of callbacks all use it, and converting it to/from strings to lists (and then, inside the callbacks, a numpy array) really slows things down. A few benchmark operations take > 2 minutes using a dash store, and < 15 seconds using a global variable.
A few benchmark operations take > 2 minutes using a dash store, and < 15 seconds using a global variable.
The store data is sent back and forth between the client and the server for each callback. This create network latency. You can try out multi-output and combine the callbacks so thereās only one requests with the store data instead.
Oh, wow - thatās a game changing feature! I have yet to make a count, but Iām guessing I could merge about 10 callbacks into a single one thatās going to be faster and probably also easier to read and understand. Things just keep getting betterā¦
Can you initialize multiple stores from one global store?
Letās say I have a multi-page app and want to store an expensive query in a global store on the index page. Then, I want each page to have its own store that only uses a part of the data obtained from the global store.
Is this theoretically feasible with the current implementation of dcc.Store?
That was more my musing, wondering if an āappendā operation were built into the Storage component somewhere, because that would be very efficient if I wanted to save a small live-stream into Dash.
A less efficient than the above (though still more efficient than the other alternatives I can think of), but practically the same thing, method of sending streaming data into a dcc.Store object would be to create a single callback where the same dcc.Storedata attribute is both the Output, as well as a State input.
By doing this semi-circular logic, the first time data is sent to dcc.Store, you can send it normally, but once the stream gets going and you want to start appending, simply reference the same dcc.Store in the State (which has your streamās beginning data already), append to that data object, and send it back to dcc.Store in the Output.
This ability to do this is one of Dashās strong points. Let me know if you need more help.
I face the same error I am using PreventUpdate to prevent my updates and now itās throwing Exceptions. Itāll be great if I can suppress this specific Exception in my application.
hi @VELAZ
For future reference, Dash Bootstrap made some changes when it migrated to version 1. You can read more about the changes and the no_gutters being droppped in the migration guide.