Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: kanban failing tests

DarkPhoenix2704dff489ed14c3
diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts
index 388a4a74ae..e176e3c01e 100644
--- a/packages/nc-gui/composables/useKanbanViewStore.ts
+++ b/packages/nc-gui/composables/useKanbanViewStore.ts
@@ -55,7 +55,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
const { updateViewMeta } = viewStore
- const { views } = storeToRefs(viewStore)
+ const { setMeta } = useMetas()
// save history of stack changes for undo/redo
const moveHistory = ref<{ op: 'added' | 'removed'; pk: string; stack: string; index: number }[]>([])
@@ -586,13 +586,14 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
(o) => o.title !== stackTitle,
)
const cdf = groupingFieldColumn.value.cdf ? groupingFieldColumn.value.cdf.replace(/^'/, '').replace(/'$/, '') : null
- await api.dbTableColumn.update(groupingFieldColumn.value.id!, {
+ const newMeta = await api.dbTableColumn.update(groupingFieldColumn.value.id!, {
...groupingFieldColumn.value,
colOptions: {
options: newOptions,
},
cdf: cdf === stackTitle ? null : cdf,
} as any)
+ await setMeta(newMeta)
const splicedOps = [...groupingFieldColOptions.value].splice(stackIdx, 1)
// update kanban stack meta
diff --git a/packages/nocodb/src/services/kanbans.service.ts b/packages/nocodb/src/services/kanbans.service.ts
index ce160edb15..2f8660c82b 100644
--- a/packages/nocodb/src/services/kanbans.service.ts
+++ b/packages/nocodb/src/services/kanbans.service.ts
@@ -271,6 +271,11 @@ export class KanbansService {
newStackMeta.push(uncategorizedStack);
// Process each column option, preserving existing order when possible
+ let currentMaxOrder = Math.max(
+ ...existingStacks.map((s) => s.order || 0),
+ 0,
+ );
+
for (const option of colOptions.options) {
const existingStack = existingStacks.find(
(stack) => stack.id === option.id,
@@ -285,13 +290,10 @@ export class KanbansService {
});
} else {
// Add new stack for new option - assign next available order
- const maxOrder = Math.max(
- ...existingStacks.map((s) => s.order || 0),
- 0,
- );
+ currentMaxOrder += 1; // Increment for each new item
newStackMeta.push({
...option,
- order: maxOrder + 1, // Assign next order for new items
+ order: currentMaxOrder,
collapsed: false,
});
}