Description
The dehydrated grid state converts moved column indexes into moved column names. The idea was we would be ok if the column name order changed from the server when the workspace was applied to the table on a future load.
However, the actual dehydration algorithm does not account for moves when replacing indexes with column names.
Steps to reproduce
- Create a table with columns
A, B, C
- Move A to the end (0 -> 2). Now order is
B, C, A
- Move C to the beginning (1 -> 0). Now order is
C, B, A
The moved columns array should be [{ from: 0, to: 2 }, { from: 1, to: 0 }]
Expected results
Dehydrated grid state contains moved columns [{ from: 'A', to: 'C' }, { from: 'C', to: 'B' }]
Actual results
Dehydrated grid state contains moved columns [{ from: 'A', to: 'C' }, { from: 'B', to: 'A' }]
Additional details and attachments
This will require a workspace migration to not break existing workspaces. We could just opt to keep the visible indexes which is the intended use of the moved columns. We already store a copy of the column names, so if the server had a different order, we could do some reconciliation on hydrate.
Versions