fix: minor type and ui fixes, fix solid reactivity warning
This commit is contained in:
parent
d21f7fa335
commit
537c46d3d7
4 changed files with 47 additions and 35 deletions
38
src/db.ts
38
src/db.ts
|
@ -1,4 +1,4 @@
|
|||
import { type Accessor, createEffect, createMemo, createSignal, DEV, type Setter } from "solid-js";
|
||||
import { type Accessor, createEffect, createMemo, createRoot, createSignal, DEV, type Setter } from "solid-js";
|
||||
|
||||
import { Kysely, type NotNull, sql } from "kysely";
|
||||
import type { DB } from "kysely-codegen";
|
||||
|
@ -41,25 +41,27 @@ const sqlJsDialect = () => {
|
|||
}
|
||||
};
|
||||
|
||||
createEffect(() => {
|
||||
const db = rawDb();
|
||||
const kyselyDb = createRoot(() => {
|
||||
createEffect(() => {
|
||||
const db = rawDb();
|
||||
|
||||
if (db) {
|
||||
db.create_function("is_not_empty", (str: string | null) => {
|
||||
return str !== null && str !== "";
|
||||
if (db) {
|
||||
db.create_function("is_not_empty", (str: string | null) => {
|
||||
return str !== null && str !== "";
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return createMemo(() => {
|
||||
const currentSqlJsDialect = sqlJsDialect();
|
||||
|
||||
if (!currentSqlJsDialect) {
|
||||
throw new Error("no db selected!");
|
||||
}
|
||||
|
||||
return new Kysely<DB>({
|
||||
dialect: currentSqlJsDialect,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const kyselyDb = createMemo(() => {
|
||||
const currentSqlJsDialect = sqlJsDialect();
|
||||
|
||||
if (!currentSqlJsDialect) {
|
||||
throw new Error("no db selected!");
|
||||
}
|
||||
|
||||
return new Kysely<DB>({
|
||||
dialect: currentSqlJsDialect,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue