Skip to content

Commit 9fffd6a

Browse files
committed
don't assume window.crypto on demo app
1 parent 6b7e57a commit 9fffd6a

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

packages/idb-cache-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@types/react-dom": "^18.3.7",
3838
"idb": "^8.0.2",
3939
"playwright": "^1.52.0",
40-
"typescript": "^5.8.3"
40+
"typescript": "^5.8.3",
41+
"uuid": "^11.1.0"
4142
}
4243
}

packages/idb-cache-app/src/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "./App.css";
2+
import { v4 as uuidv4 } from "uuid";
23
// import { IDBCache } from "@instructure/idb-cache";
34
import { IDBCache } from "../../idb-cache/dist";
45
import { useCallback, useRef, useState, useEffect } from "react";
@@ -33,13 +34,13 @@ const DEFAULT_MAX_CHUNKS_STORED = 5000;
3334
// Do *not* store cacheKey to localStorage in production.
3435
let initialCacheKey: string = localStorage.cacheKey;
3536
if (!initialCacheKey) {
36-
initialCacheKey = crypto.randomUUID();
37+
initialCacheKey = uuidv4();
3738
localStorage.cacheKey = initialCacheKey;
3839
}
3940

4041
let initialCacheBuster: string = localStorage.cacheBuster;
4142
if (!initialCacheBuster) {
42-
initialCacheBuster = crypto.randomUUID();
43+
initialCacheBuster = uuidv4();
4344
localStorage.cacheBuster = initialCacheBuster;
4445
}
4546

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)