Browse Source

fix(api): handle if coloptions is null/undefined

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3563/head
Pranav C 2 years ago
parent
commit
e74d065d96
  1. 10
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

10
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2357,10 +2357,12 @@ class BaseModelSqlv2 {
if (args.options?.length) { if (args.options?.length) {
groupingValues = new Set(args.options); groupingValues = new Set(args.options);
} else if (column.uidt === UITypes.SingleSelect) { } else if (column.uidt === UITypes.SingleSelect) {
const colOptions = await column.getColOptions< const colOptions = await column.getColOptions<{
SelectOption[] & { options } options: SelectOption[];
>(); }>();
groupingValues = new Set(colOptions.options.map((opt) => opt.title)); groupingValues = new Set(
(colOptions?.options ?? []).map((opt) => opt.title)
);
groupingValues.add(null); groupingValues.add(null);
} else { } else {
groupingValues = new Set( groupingValues = new Set(

Loading…
Cancel
Save