upgrades
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { loadAllWasm } from "@/utils/wasmLoader";
|
||||
|
||||
const Playground = dynamic(() => import("@/components/Playground"), {
|
||||
ssr: false,
|
||||
@@ -20,14 +21,7 @@ const Playground = dynamic(() => import("@/components/Playground"), {
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
Loading{" "}
|
||||
<a
|
||||
href="https://github.com/rhaiscript/playground"
|
||||
target="_blank"
|
||||
>
|
||||
Rhai Playground
|
||||
</a>
|
||||
...
|
||||
Loading WASM...
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -35,12 +29,24 @@ const Playground = dynamic(() => import("@/components/Playground"), {
|
||||
|
||||
export default function Home() {
|
||||
const [isClient, setIsClient] = useState(false);
|
||||
const [isWasmLoaded, setIsWasmLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsClient(true);
|
||||
|
||||
// Load all WASM modules
|
||||
loadAllWasm()
|
||||
.then(() => {
|
||||
setIsWasmLoaded(true);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to load WASM modules:', error);
|
||||
// Still allow the app to load, but WASM features may not work
|
||||
setIsWasmLoaded(true);
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!isClient) {
|
||||
if (!isClient || !isWasmLoaded) {
|
||||
return (
|
||||
<div
|
||||
id="loading"
|
||||
|
||||
Reference in New Issue
Block a user