Fig.update_yaxes(categoryorder = ) introduces categories when data is selected

I have developed a Python Dash app, where users can select samples to perform statistical analyses on. By default, all of the samples are initially selected and the scatter graph showing the top 50 values is displayed as shown:

However, when the users select the data: the top 50 values adjust accordingly but three extra categories (with no values) are added for some reason. For example:

Here is the pls1_top_50_features dataframe when the data is selected (where those extra categories are NOT present):

                                          Metabolites  PLSDA1 VIP score
0                                     D-(+)-Raffinose          0.264496
1                                         Myoinositol          0.249230
2                                           Melibiose          0.247374
3                            3-Hydroxymethylglutarate          0.216225
4                                        D-(+)-Malate          0.214350
5                                   L-(+)-Lactic Acid          0.207848
6                               (S)-Hexyl-glutathione          0.193233
7                                  Indole-3-acetamide          0.185193
8                                        L-Tryptophan          0.182106
9                                             Lactose          0.174501
10                                       D-Tryptophan          0.162587
11                                             Purine          0.161442
12                                      2-Aminophenol          0.159380
13                             5-Hydroxy-L-tryptophan          0.150975
14                                             Pterin          0.131837
15                                         Riboflavin          0.131537
16                                   5-Methylcytidine          0.127013
17                                         N_AP_FHxSA          0.125591
18                   2-Hydroxy-2',5'-dichlorobiphenyl          0.121294
19                                      Amentoflavone          0.120487
20                            Palmitoleic Acid (16:1)          0.110705
21                                  d7-PA (15:0-18:1)          0.103092
22                                Stearic Acid (18:0)          0.102067
23                                        Orotic Acid          0.101844
24                    Mono-carboxy-isononyl phthalate          0.101050
25                                   Indole-3-acetate          0.100776
26                                           PS 38:01          0.100719
27                               D-(+)-Gluconolactone          0.099537
28                                             Uracil          0.098781
29                           DHLVGR (Tryptic Peptide)          0.097728
30                                    D-(+)-Trehalose          0.094653
31                                         Tryptamine          0.093375
32                                         Pyridoxine          0.092373
33                                   beta-Gentiobiose          0.092021
34                                          Stachyose          0.089827
35                                         Citrulline          0.087756
36                                       Fumaric Acid          0.086345
37                                      Maltotetraose          0.084090
38                                  Oleic Acid (18:1)          0.083224
39                                          Itaconate          0.082990
40                           N-Acetyl-L-aspartic Acid          0.082379
41                                          D-Maltose          0.082106
42                                    D-Sedoheptulose          0.081213
43                               Calcium Pantothenate          0.080879
44  1-Palmitoyl-2-oleoyl-sn-glycero-3-phosphoethan...          0.080597
45                                           Camphene          0.077324
46  1,2-Dipentadecanoyl-sn-glycero-3-phosphoethano...          0.076706
47                            4,6-Dioxoheptanoic Acid          0.072699
48                                        Deoxyribose          0.070024
49                                           PC 32:01          0.069967

The code:

    import plotly.express as px

    fig = px.scatter(pls1_top_50_features, 
                          x = pls1_top_50_features["PLSDA1 VIP score"], 
                          y = pls1_top_50_features["Metabolites"])
    fig.layout.width = 500
    fig.layout.height = 800
    fig.update_yaxes(type = 'category', 
                    categoryorder='max ascending', #Puts the samples in order
                    tickmode = 'linear') #Displays all categories

These values are only added when categoryorder = <VALUE> is set in update_yaxes(). I have tried using 'total ascending' and 'min ascending' according to the documentation, but I still get the same issue.

Has anyone else experienced this issue? Any help would be much appreciated, thanks!