Skip to content

Commit 8fa8011

Browse files
committed
- revert wasm caching
1 parent 09dde73 commit 8fa8011

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/components/FileManager.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export function FileManager() {
6565
wasmCached.current = true;
6666
}
6767
} catch (error) {
68+
console.log(error)
6869
// File not ready yet, continue checking
6970
}
7071
}, 1000);
@@ -76,16 +77,18 @@ export function FileManager() {
7677
(async () => {
7778
const wc = await webcontainer;
7879

79-
if (!wasmCached.current) {
80-
const cachedWasm = await fetchCachedWasmFile();
81-
if (cachedWasm) {
82-
await wc.fs.writeFile(VERSIONED_RAILS_WASM_FILE_NAME, cachedWasm);
83-
console.log(`Rails WASM v${RAILS_WASM_PACKAGE_VERSION} loaded from cache`);
84-
wasmCached.current = true;
85-
} else {
86-
await cacheWasmFile(wc);
87-
}
88-
}
80+
// FIXME: caching doesn't work in Safari. Need to figure out a different strategy.
81+
//
82+
// if (!wasmCached.current) {
83+
// const cachedWasm = await fetchCachedWasmFile();
84+
// if (cachedWasm) {
85+
// await wc.fs.writeFile(VERSIONED_RAILS_WASM_FILE_NAME, cachedWasm);
86+
// console.log(`Rails WASM v${RAILS_WASM_PACKAGE_VERSION} loaded from cache`);
87+
// wasmCached.current = true;
88+
// } else {
89+
// await cacheWasmFile(wc);
90+
// }
91+
// }
8992

9093
Object.entries(files).forEach(([_, fd]) => {
9194
const dir = fd.path.split('/').filter(Boolean).slice(-2, -1)[0];

src/templates/default/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"preinstall": "node scripts/preinstall.js",
87
"dev": "vite",
98
"test": "node --disable-warning=ExperimentalWarning ./scripts/test.js",
109
"test:watch": "node --disable-warning=ExperimentalWarning --watch --watch-path=./workspace ./scripts/test.js",
@@ -13,6 +12,7 @@
1312
"dependencies": {
1413
"@electric-sql/pglite": "^0.3.1",
1514
"@ruby/wasm-wasi": "^2.7.1",
15+
"@rails-tutorial/wasm": "^8.0.2-rc.1",
1616
"express": "^5.1.0",
1717
"multer": "^2.0.1",
1818
"set-cookie-parser": "^2.7.1"

0 commit comments

Comments
 (0)