Skip to content

Commit efa7a82

Browse files
authored
Fix user display name retrieval with optional chaining and filtering (#300)
* Fix user display name retrieval with optional chaining and filtering * 1.34.3
1 parent 1d4988b commit efa7a82

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "query-builder",
3-
"version": "1.34.2",
3+
"version": "1.34.3",
44
"description": "Introduces new user interfaces for building queries in Roam",
55
"main": "./build/main.js",
66
"author": {

src/utils/conditionToDatalog.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ const translator: Record<string, Translator> = {
571571
`[:find (pull ?n [:node/title]) :where [?u :user/display-page ?n]]`
572572
) as [PullBlock][]
573573
)
574-
.map((d) => d[0][":node/title"] || "")
574+
.map((d) => d[0]?.[":node/title"] || "")
575+
.filter(Boolean)
575576
.concat(["{current user}"]),
576577
placeholder: "Enter the display name of any user with access to this graph",
577578
},
@@ -601,7 +602,8 @@ const translator: Record<string, Translator> = {
601602
`[:find (pull ?n [:node/title]) :where [?u :user/display-page ?n]]`
602603
) as [PullBlock][]
603604
)
604-
.map((d) => d[0][":node/title"] || "")
605+
.map((d) => d[0]?.[":node/title"] || "")
606+
.filter(Boolean)
605607
.concat(["{current user}"]),
606608
placeholder: "Enter the display name of any user with access to this graph",
607609
},

0 commit comments

Comments
 (0)