Skip to content

Commit d9e8c0d

Browse files
committed
Adding useQuery to page props
1 parent 927716b commit d9e8c0d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

components/notion/notion.app.mjs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ export default {
2121
pageId: {
2222
type: "string",
2323
label: "Page ID",
24-
description: "Select a page or provide a page ID",
25-
async options({ prevContext }) {
26-
const response = await this.search(undefined, {
24+
description: "Search for a page or provide a page ID",
25+
useQuery: true,
26+
async options({
27+
query, prevContext,
28+
}) {
29+
const response = await this.search(query || undefined, {
2730
start_cursor: prevContext.nextPageParameters ?? undefined,
31+
filter: {
32+
property: "object",
33+
value: "page",
34+
},
2835
});
2936
const options = this._extractPageTitleOptions(response.results);
3037
return this._buildPaginatedOptions(options, response.next_cursor);
@@ -33,12 +40,14 @@ export default {
3340
pageIdInDatabase: {
3441
type: "string",
3542
label: "Page ID",
36-
description: "Select a page from the database or provide a page ID",
43+
description: "Search for a page from the database or provide a page ID",
44+
useQuery: true,
3745
async options({
38-
prevContext, databaseId,
46+
query, prevContext, databaseId,
3947
}) {
4048
this._checkOptionsContext(databaseId, "Database ID");
4149
const response = await this.queryDatabase(databaseId, {
50+
query,
4251
start_cursor: prevContext.nextPageParameters ?? undefined,
4352
});
4453
const options = this._extractPageTitleOptions(response.results);

0 commit comments

Comments
 (0)