Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client): sql result taking unnecessary space when inactive
Elian Doran49c80f0e0bf2
diff --git a/apps/client/src/widgets/sql_result.tsx b/apps/client/src/widgets/sql_result.tsxindex 7606517745..e4fde650b9 100644--- a/apps/client/src/widgets/sql_result.tsx+++ b/apps/client/src/widgets/sql_result.tsx@@ -10,13 +10,14 @@ export default function SqlResults() {const [ results, setResults ] = useState<SqlExecuteResults>();useTriliumEvent("sqlQueryResults", ({ ntxId: eventNtxId, results }) => {- if (eventNtxId !== ntxId) return;+ if (eventNtxId !== ntxId) return;setResults(results);})+ const isEnabled = note?.mime === "text/x-sqlite;schema=trilium";return (- <div className="sql-result-widget">- {note?.mime === "text/x-sqlite;schema=trilium" && (+ <div className={`sql-result-widget ${!isEnabled ? "hidden-ext" : ""}`}>+ {isEnabled && (results?.length === 1 && Array.isArray(results[0]) && results[0].length === 0 ? (<Alert type="info">{t("sql_result.no_rows")}@@ -26,9 +27,9 @@ export default function SqlResults() {{results?.map(rows => {// inserts, updatesif (typeof rows === "object" && !Array.isArray(rows)) {- return <pre>{JSON.stringify(rows, null, "\t")}</pre>+ return <pre>{JSON.stringify(rows, null, "\t")}</pre>}-+// selectsreturn <SqlResultTable rows={rows} />})}@@ -59,4 +60,4 @@ function SqlResultTable({ rows }: { rows: object[] }) {</tbody></table>)-}\ No newline at end of file+}