4a6ad48a62
Fixes https://github.com/twentyhq/twenty/issues/14442 Issues were 1. Table headers always used label metadata identifier (or record text) as first column, while table body followed viewFields positions 2. Label metadata identifier should always be visible and in first position for the table views to work as expected, while when updating the label metadata identifier for an object, no changes were brought to the viewFields To fix that 1. In the BE: - a new logic is implemented to i) update label identifier's viewFields position and visibility when an object's label identifier is updated to a new field; ii) add validation on the update of a viewField's position and visibility to make sure the label identifier's viewField always has the lowest position + is visible - a command was added to check all existing views and viewfields 3. In the FE: at first I tried to replicate the logic of the headers (based on the label identifier rather than the positions) on the body, but it was too complex and error-prone as in multiple places we are based on the positions. It also feels more right to have only one source of truth which is the viewField position. @lucasbordeau if that does not suit you, we can throw an error if the field with the lowest position is not the label metadata identifier, as you said the table view will be very buggy / wont work if the label identifier is not in the first position. but now it should never be the case thanks to the validation implemented in the BE This should be migrated to viewFieldService V2 when relevant @Weiko @prastoin