diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 04e51fc212..f14d576c44 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -1071,6 +1071,26 @@ describe.each([ ) }) + it("can add a new group by field that is invisible, even if required on the table", async () => { + view.schema!.name = { visible: false } + await config.api.viewV2.update(view) + + const { rows } = await config.api.row.search(view.id) + expect(rows).toHaveLength(2) + expect(rows).toEqual( + expect.arrayContaining([ + { + country: "USA", + age: 65, + }, + { + country: "UK", + age: 61, + }, + ]) + ) + }) + it("can add a new calculation field", async () => { view.schema!.count = { visible: true, diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index be7259b057..e1568eac6e 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -122,7 +122,11 @@ async function guardViewSchema( } await checkReadonlyFields(table, view) - checkRequiredFields(table, view) + + if (!helpers.views.isCalculationView(view)) { + checkRequiredFields(table, view) + } + checkDisplayField(view) }