Skip to content

Commit ae6d983

Browse files
committed
Improve code, remove unused type
1 parent 3ffa1af commit ae6d983

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

plugins/notion/src/api.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Client, collectPaginatedAPI, isFullBlock, isFullDatabase, isFullPage }
22
import type {
33
BlockObjectResponse,
44
GetDatabaseResponse,
5-
GetPagePropertyResponse,
65
PageObjectResponse,
76
RichTextItemResponse,
87
} from "@notionhq/client/build/src/api-endpoints"
@@ -421,7 +420,7 @@ export async function fetchRelationIdsForPageProperty(pageId: string, propertyId
421420
})
422421

423422
if (response.object === "list") {
424-
return response.results.flatMap(item => (item.type === "relation" ? [item.relation.id] : []))
423+
return response.results.map(item => (item.type === "relation" ? item.relation.id : "")).filter(id => id !== "")
425424
}
426425
if (response.type === "relation") {
427426
return [response.relation.id]

0 commit comments

Comments
 (0)