Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/miden/front/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MidenContextProvider, useMidenContext } from 'lib/miden/front/client';
import { PropsWithChildren } from 'lib/props-with-children';
import { WalletStoreProvider } from 'lib/store/WalletStoreProvider';

import { getMidenClient } from '../sdk/miden-client';
import { getMidenClient, withWasmClientLock } from '../sdk/miden-client';
import { TokensMetadataProvider } from './assets';

// Pre-create the modal container to avoid flash when first opening
Expand Down Expand Up @@ -38,7 +38,9 @@ export const MidenProvider: FC<PropsWithChildren> = ({ children }) => {
useEffect(() => {
const initializeClient = async () => {
try {
await getMidenClient();
await withWasmClientLock(async () => {
await getMidenClient();
});
} catch (err) {
console.error('Failed to initialize Miden client singleton:', err);
}
Expand Down