Dash 2.0 dcc Store sorting sorting alphabetically

Hello,

I recently upgraded to Dash 2.0, mainly to use Dash Boostrap Components v1 and noticed something quite odd.

When using dcc.Store to store a dictionary, as of Dash 2.0, dictionary keys get sorted. The example I have is storing a dataframe.to_dict(‘records’) inside another dictionary, meaning the structure I have is:

dcc.Store.data = {'b': df.to_dict('records'), 
                                'a': df2.to_dict('records'}

It would be fine if it was sorted only on the outer dict keys, but it is actually sorting inside the dataframe as well. So dataframe columns get all messed up.

Is this intentional?

Hi @gmbdr

No, this is not intentional. It’s been fixed but not yet released. Stay tuned!

Thanks Ann.

Will do.

@gmbdr

The fix for this is in the latest release of Plotly.py (v5.4.0) :confetti_ball:

pip install plotly==5.4.0 (can be upgraded independently of the Dash version)

1 Like