Skip to content

Commit c2d0679

Browse files
committed
Added warning if OPFS config is invalid. Moved viewport meta tag to index.html.
1 parent a2b02df commit c2d0679

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

demos/react-supabase-todolist/src/app/index.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ root.render(<App />);
99

1010
export function App() {
1111
return (
12-
<>
13-
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
14-
<ThemeProviderContainer>
15-
<SystemProvider>
16-
<RouterProvider router={router} />
17-
</SystemProvider>
18-
</ThemeProviderContainer>
19-
</>
12+
<ThemeProviderContainer>
13+
<SystemProvider>
14+
<RouterProvider router={router} />
15+
</SystemProvider>
16+
</ThemeProviderContainer>
2017
);
2118
}

demos/react-supabase-todolist/src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html lang="en">
22
<head>
33
<meta name="theme-color" content="#c44eff" />
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
45
<link rel="apple-touch-icon" href="/icons/icon.png" />
56
<link rel="stylesheet" href="./app/globals.css" />
67
<script type="module" src="./app/index.tsx"></script>

packages/web/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export interface ResolvedWASQLiteOpenFactoryOptions extends ResolvedWebSQLOpenOp
2121
export class WASQLiteOpenFactory extends AbstractWebSQLOpenFactory {
2222
constructor(options: WASQLiteOpenFactoryOptions) {
2323
super(options);
24+
25+
assertValidWASQLiteOpenFactoryOptions(options);
2426
}
2527

2628
get waOptions(): WASQLiteOpenFactoryOptions {
@@ -84,3 +86,18 @@ export class WASQLiteOpenFactory extends AbstractWebSQLOpenFactory {
8486
}
8587
}
8688
}
89+
90+
/**
91+
* Asserts that the factory options are valid.
92+
*/
93+
function assertValidWASQLiteOpenFactoryOptions(options: WASQLiteOpenFactoryOptions): void {
94+
// The OPFS VFS only works in dedicated web workers.
95+
if ('vfs' in options && 'flags' in options) {
96+
const { vfs, flags = {} } = options;
97+
if (vfs !== WASQLiteVFS.IDBBatchAtomicVFS && 'useWebWorker' in flags && !flags.useWebWorker) {
98+
throw new Error(
99+
`Invalid configuration: The 'useWebWorker' flag must be true when using an OPFS-based VFS (${vfs}).`
100+
);
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)