Skip to content

Commit 55fd6a1

Browse files
committed
Improve sqlite3 warning handling in WasmSqliteDriver
Replaces the previous warning handler with a function that filters out irrelevant OPFS-related warnings and logs others to the console. This addresses noisy logs as discussed in the referenced sqlite-wasm issue.
1 parent e81b1ad commit 55fd6a1

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

packages/web/src/WasmSqliteDriver.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
import {
2-
constVoid,
2+
bytesToHex,
33
createPreparedStatementsCache,
44
CreateSqliteDriver,
55
SqliteDriver,
66
SqliteRow,
7-
bytesToHex,
87
} from "@evolu/common";
98
import sqlite3InitModule, {
10-
PreparedStatement,
119
Database,
10+
PreparedStatement,
1211
} from "@evolu/sqlite-wasm";
1312

14-
// TODO: Do we still need that?
15-
// https://github.com/sqlite/sqlite-wasm/issues/62
1613
// @ts-expect-error Missing types.
1714
globalThis.sqlite3ApiConfig = {
18-
warn: constVoid,
15+
warn: (arg: unknown) => {
16+
// Ignore irrelevant warning.
17+
// https://github.com/sqlite/sqlite-wasm/issues/62
18+
if (
19+
typeof arg === "string" &&
20+
arg.startsWith("Ignoring inability to install OPFS sqlite3_vfs")
21+
)
22+
return;
23+
// eslint-disable-next-line no-console
24+
console.warn(arg);
25+
},
1926
};
2027

2128
// Init ASAP.

0 commit comments

Comments
 (0)