Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/roam/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roam",
"version": "0.9.1",
"version": "0.10.0",
"description": "Discourse Graph Plugin for roamresearch.com",
"scripts": {
"postinstall": "patch-package",
Expand Down
17 changes: 0 additions & 17 deletions apps/roam/src/components/settings/QuerySettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ const QuerySettings = ({
/>
<DefaultFilters extensionAPI={extensionAPI} />
</Label>
<Checkbox
defaultChecked={extensionAPI.settings.get("async-q") as boolean}
onChange={(e) => {
const target = e.target as HTMLInputElement;
extensionAPI.settings.set("async-q", target.checked);
}}
labelElement={
<>
Use Backend Query (Beta)
<Description
description={
"This will use Roam's Backend Query. It helps prevent the UI from freezing during large queries but is still in beta and may occasionally produce inaccurate results."
}
/>
</>
}
/>
</div>
);
};
Expand Down
15 changes: 6 additions & 9 deletions apps/roam/src/utils/fireQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { DEFAULT_RETURN_NODE } from "./parseQuery";
import { DiscourseNode } from "./getDiscourseNodes";
import { DiscourseRelation } from "./getDiscourseRelations";
import nanoid from "nanoid";
import getExtensionApi from "roamjs-components/util/extensionApiContext";

export type QueryArgs = {
returnNode?: string;
Expand Down Expand Up @@ -327,22 +326,20 @@ const fireQuery: FireQuery = async (_args) => {
try {
const nodeEnv = getNodeEnv();
const queryId = nodeEnv === "development" ? nanoid(4) : "";
const isAsyncQ = getExtensionApi().settings.get("async-q");

if (nodeEnv === "development") {
console.groupCollapsed(
`🔍 Roam Query - ${queryId} - ${isAsyncQ ? "async.q" : "fast.q"}`,
);
console.groupCollapsed(`🔍 Roam Query - ${queryId}`);
console.log("%c" + query, "color: #94a3b8; font-family: monospace;");
if (inputs.length) console.log("Inputs:", ...inputs);
console.time(`Query - ${queryId}`);
console.groupEnd();
}

const queryResults = await (isAsyncQ
? //@ts-ignore - todo add async q to roamjs-components
window.roamAlphaAPI.data.async.q(query, ...inputs)
: window.roamAlphaAPI.data.fast.q(query, ...inputs));
//@ts-ignore - todo add async q to roamjs-components
const queryResults = await window.roamAlphaAPI.data.async.q(
query,
...inputs,
);

if (nodeEnv === "development") {
console.timeEnd(`Query - ${queryId}`);
Expand Down