Core view migration fixes (#14166)

Bugs found with feature flag IS_CORE_VIEW_ENABLED:
- Switching a view type does switches but does not update the option
dropdown selected menu item, we have to refresh ==> **fixed**
- Reordering a field in the option dropdown causes a bug because it
tries to update with a decimal position like 1.5 but the position field
on core views is integer ==> **fixed**
Hidding a field triggers the update, but making it visible again right
after that does not trigger the DB update, we have to refresh the app
==> **not fixed, medium bug**
Reordering core view groups in option dropdown fails ==> **fixed**
Showing / hidding core view groups fails ==> **fixed**
Creating a table group view works but if we select kanban right after it
fails ==> **fixed**
Move right / move left on kanban core view group doesn’t do anything ==>
**fixed**
Deleting a view from the view dropdown fails ==> **fixed**
Creating a view from another view does not copy the view groups ==>
**not fixed, medium bug**
Move left / right has a strange behavior, not working consistently, it
sends always the same position ==> **not fixed, medium bug**
View re-order optimistic update is broken, but the DB update works ==>
**now it's dancing not fixed, medium bug**


Next steps:
- we should re-work the optimistic behaviors of view updates but let's
clean the code first
This commit is contained in:
Charles Bochet
2025-08-29 20:01:12 +02:00
committed by GitHub
parent c1870c3990
commit a132a0e88b
7 changed files with 76 additions and 34 deletions
@@ -93,29 +93,10 @@ export const useSetViewTypeFromLayoutOptionsMenu = () => {
if (availableFieldsForKanban.length === 0) {
throw new Error('No fields for kanban - should not happen');
}
const previouslySelectedKanbanField = availableFieldsForKanban.find(
(fieldsForKanban) =>
fieldsForKanban.id ===
currentView.viewGroups[0].fieldMetadataId,
);
const kanbanField = isDefined(previouslySelectedKanbanField)
? previouslySelectedKanbanField
: availableFieldsForKanban[0];
if (!isDefined(previouslySelectedKanbanField)) {
updateCurrentViewParams.kanbanFieldMetadataId =
currentView.viewGroups[0].fieldMetadataId;
}
const hasViewGroups = currentView.viewGroups.some(
(viewGroup: ViewGroup) =>
viewGroup.fieldMetadataId === kanbanField.id,
);
if (!hasViewGroups) {
if (currentView.viewGroups.length === 0) {
const viewGroups = await createViewGroupAssociatedWithKanbanField(
kanbanField.id,
availableFieldsForKanban[0].id,
currentView.id,
);
loadRecordIndexStates(