diff --git a/package-lock.json b/package-lock.json index 9d6d23d..552b65a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "workbench", - "version": "1.6.1", + "version": "1.6.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "workbench", - "version": "1.6.1", + "version": "1.6.2", "dependencies": { "@mozilla/readability": "^0.3.0", "buffer": "^6.0.3", diff --git a/package.json b/package.json index 26a6a00..9436462 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@types/mozilla-readability": "^0.2.0", "@types/turndown": "^5.0.1" }, - "version": "1.6.1", + "version": "1.6.2", "samepage": { "extends": "node_modules/roamjs-components/package.json" } diff --git a/src/features/attributeSelect.tsx b/src/features/attributeSelect.tsx index 4265dc6..09bcb4d 100644 --- a/src/features/attributeSelect.tsx +++ b/src/features/attributeSelect.tsx @@ -286,21 +286,22 @@ const AttributeConfigPanel = ({ }, [configUid]); const [attributesInGraph, setAttributesInGraph] = useState([]); const [noAttributesInGraph, setNoAttributesInGraph] = useState(false); - const getAttributesInGraph = () => { - const attributesInGraph = ( - window.roamAlphaAPI.data.fast.q( + const getAttributesInGraph = async () => { + const results = + // @ts-ignore + (await window.roamAlphaAPI.data.backend.q( `[:find - (pull ?page [:node/title]) - :where - [?b :attrs/lookup _] - [?b :entity/attrs ?a] - [(untuple ?a) [[?c ?d]]] - [(get ?d :value) ?s] - [(untuple ?s) [?e ?uid]] - [?page :block/uid ?uid] - ]` - ) as [PullBlock][] - ).map((p) => p[0]?.[":node/title"] || ""); + (pull ?page [:node/title]) + :where + [?b :attrs/lookup _] + [?b :entity/attrs ?a] + [(untuple ?a) [[?c ?d]]] + [(get ?d :value) ?s] + [(untuple ?s) [?e ?uid]] + [?page :block/uid ?uid] + ]` + )) as [PullBlock][]; + const attributesInGraph = results.map((p) => p[0]?.[":node/title"] || ""); if (attributesInGraph.length === 0) { setNoAttributesInGraph(true); } else { @@ -389,8 +390,8 @@ const AttributeConfigPanel = ({ loading={isLoading} onClick={() => { setIsLoading(true); - setTimeout(() => { - getAttributesInGraph(); + setTimeout(async () => { + await getAttributesInGraph(); setIsLoading(false); focusAndOpenSelect();