I’m developing an app which chains together several elements to dynamically filter through songs from a collection of music. The general flow looks like this.
- Spotify URI elements are parsed from the page URL, and the playlist/library is retrieved via the Spotify API, then stored in a hidden div.
2.1) Slider bars for various stats are configured based on the min and max values in the data set.
2.2) User tags are retrieved from the database for the songs in the collection and stored in another hidden div. - A Dash table takes 1) the song data stored in the hidden div, 2.1) the values of the slider bars, and 2.2) the user tags stored in the other hidden div, and filters the collection by the ranges of the sliders, adds the song tags as a new column, and displays the filtered, tagged collection.
- A separate histogram for each stat updates based on 3) the filtered dataset.
My problem is that at every layer >2, a callback is fired for the element before the lower level elements are finished loading. The inputs on this initial callback is thus often None, and these None values cause Type Errors in the downstream code. This isn’t a problem on the client side - everything seems to work as normal - but it’s a huge pain for my server logs. I’ve got upwards of 40 downstream elements that error at least once every time a new playlist is viewed. This not only spams my logs in production, but also makes tracing more problematic errors a needle & haystack operation.
Is there some null value that I could have my callback functions return so that I can detect when a necessary input is None and emit this null value? Or is there some way I can silence/ignore specific types of Exceptions so that I can just raise this CallbackChain exception instead of a TypeError etc?
Best,
Christopher