Skip to content

Commit 097c149

Browse files
authored
Merge pull request #362 from NotionX/fix-group-by-board
Fixed groupBy board_coumns being added to non board collections query
2 parents 06d6b2d + a71d25f commit 097c149

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/notion-client/src/notion-api.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ export class NotionAPI {
328328
) {
329329
const type = collectionView?.type
330330
const isBoardType = type === 'board'
331-
const groupBy =
332-
collectionView?.format?.board_columns_by ||
333-
collectionView?.format?.collection_group_by
331+
const groupBy = isBoardType
332+
? collectionView?.format?.board_columns_by
333+
: collectionView?.format?.collection_group_by
334334

335335
let filters = []
336336
if (collectionView.format?.property_filters) {
@@ -344,6 +344,10 @@ export class NotionAPI {
344344
})
345345
}
346346

347+
if (collectionView?.query2?.filter?.filters) {
348+
filters.push(...collectionView.query2.filter.filters)
349+
}
350+
347351
let loader: any = {
348352
type: 'reducer',
349353
reducers: {

0 commit comments

Comments
 (0)