reflex-dev / reflex-ag-grid

14 stars 2 forks source link

AgGrid auto_size_strategy failure only with rx.match #28

Open bertbarabas opened 4 weeks ago

bertbarabas commented 4 weeks ago

In general auto_size_strategy={"type": "fitCellContents"} works, BUT if it is used in an rx.ag_grid that is under the control of rx.match, it no longer works properly.

The following are screen shots showing two ag_grids, the first ag_grid (Grid1) is under the control of an rx.match, the second (Grid3) is not.

The first screen shot is the initial rendering and both ag_grids work as expected.

The second screen shot shows the result of switching (using state and rx.match) the top grid from showing Grid1 to showing Grid2 and then back to showing Grid1 (while Grid3 remains the same)

image

As you can see the auto_size_strategy is only partially rendered in the top grid in the second screen shot below because column 3 and higher are all much wider than necessary.

image

I have also seen other issues when under rx.match such as the columns out of order which I assume is part of the same issue. It's almost as though the ag_grid is only partially rendered before being displayed under rx.match. In other tests I have noticed that if it is also under a tab, switching off the tab and back cause the rx.ag_grid that was rendered incorrectly to be re-rendered correctly after the rx.tab switch.

Here is the source code for the test case:

AgGrid auto_size_strategy failure.zip

linear[bot] commented 4 weeks ago

ENG-4009 AgGrid auto_size_strategy failure only with rx.match

bertbarabas commented 4 weeks ago

I swapped the rx.match out and replaced it with two rx.cond statements to achieve the same desired effect.

The bug does not happen if I use rx.cond so a work around is to stop using rx.match and to simply replace it with a series of rx.cond statements.