mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: update initial wasm
This commit is contained in:
@@ -26,11 +26,6 @@ const App = () => {
|
|||||||
}, [systemStatus.host]);
|
}, [systemStatus.host]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initialGoWASMExec = async () => {
|
|
||||||
const go = new window.Go();
|
|
||||||
const result = await WebAssembly.instantiateStreaming(fetch("/gomark.wasm"), go.importObject);
|
|
||||||
go.run(result.instance);
|
|
||||||
};
|
|
||||||
const initialState = async () => {
|
const initialState = async () => {
|
||||||
try {
|
try {
|
||||||
await userStore.fetchCurrentUser();
|
await userStore.fetchCurrentUser();
|
||||||
@@ -39,7 +34,7 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Promise.all([initialGoWASMExec(), initialState()]).then(() => setLoading(false));
|
Promise.all([initialState()]).then(() => setLoading(false));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@@ -5,6 +5,7 @@ import { Provider } from "react-redux";
|
|||||||
import { RouterProvider } from "react-router-dom";
|
import { RouterProvider } from "react-router-dom";
|
||||||
import "./css/global.css";
|
import "./css/global.css";
|
||||||
import "./css/tailwind.css";
|
import "./css/tailwind.css";
|
||||||
|
import wasmUrl from "./gomark.wasm?url";
|
||||||
import "./helpers/polyfill";
|
import "./helpers/polyfill";
|
||||||
import "./i18n";
|
import "./i18n";
|
||||||
import "./less/highlight.less";
|
import "./less/highlight.less";
|
||||||
@@ -12,13 +13,20 @@ import router from "./router";
|
|||||||
import store from "./store";
|
import store from "./store";
|
||||||
import theme from "./theme";
|
import theme from "./theme";
|
||||||
|
|
||||||
const container = document.getElementById("root");
|
(async () => {
|
||||||
const root = createRoot(container as HTMLElement);
|
const go = new window.Go();
|
||||||
root.render(
|
const responsePromise = fetch(wasmUrl);
|
||||||
<Provider store={store}>
|
const { instance } = await WebAssembly.instantiateStreaming(responsePromise, go.importObject);
|
||||||
<CssVarsProvider theme={theme}>
|
go.run(instance);
|
||||||
<RouterProvider router={router} />
|
|
||||||
<Toaster position="top-right" />
|
const container = document.getElementById("root");
|
||||||
</CssVarsProvider>
|
const root = createRoot(container as HTMLElement);
|
||||||
</Provider>,
|
root.render(
|
||||||
);
|
<Provider store={store}>
|
||||||
|
<CssVarsProvider theme={theme}>
|
||||||
|
<RouterProvider router={router} />
|
||||||
|
<Toaster position="top-right" />
|
||||||
|
</CssVarsProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
Reference in New Issue
Block a user