@@ -286,21 +286,22 @@ const AttributeConfigPanel = ({
286286 } , [ configUid ] ) ;
287287 const [ attributesInGraph , setAttributesInGraph ] = useState < string [ ] > ( [ ] ) ;
288288 const [ noAttributesInGraph , setNoAttributesInGraph ] = useState ( false ) ;
289- const getAttributesInGraph = ( ) => {
290- const attributesInGraph = (
291- window . roamAlphaAPI . data . fast . q (
289+ const getAttributesInGraph = async ( ) => {
290+ const results =
291+ // @ts -ignore
292+ ( await window . roamAlphaAPI . data . backend . q (
292293 `[:find
293- (pull ?page [:node/title])
294- :where
295- [?b :attrs/lookup _]
296- [?b :entity/attrs ?a]
297- [(untuple ?a) [[?c ?d]]]
298- [(get ?d :value) ?s]
299- [(untuple ?s) [?e ?uid]]
300- [?page :block/uid ?uid]
301- ]`
302- ) as [ PullBlock ] [ ]
303- ) . map ( ( p ) => p [ 0 ] ?. [ ":node/title" ] || "" ) ;
294+ (pull ?page [:node/title])
295+ :where
296+ [?b :attrs/lookup _]
297+ [?b :entity/attrs ?a]
298+ [(untuple ?a) [[?c ?d]]]
299+ [(get ?d :value) ?s]
300+ [(untuple ?s) [?e ?uid]]
301+ [?page :block/uid ?uid]
302+ ]`
303+ ) ) as [ PullBlock ] [ ] ;
304+ const attributesInGraph = results . map ( ( p ) => p [ 0 ] ?. [ ":node/title" ] || "" ) ;
304305 if ( attributesInGraph . length === 0 ) {
305306 setNoAttributesInGraph ( true ) ;
306307 } else {
@@ -389,8 +390,8 @@ const AttributeConfigPanel = ({
389390 loading = { isLoading }
390391 onClick = { ( ) => {
391392 setIsLoading ( true ) ;
392- setTimeout ( ( ) => {
393- getAttributesInGraph ( ) ;
393+ setTimeout ( async ( ) => {
394+ await getAttributesInGraph ( ) ;
394395
395396 setIsLoading ( false ) ;
396397 focusAndOpenSelect ( ) ;
0 commit comments