fix(mobile): use @miden-sdk/miden-sdk/lazy and @miden-sdk/react/lazy#191
Merged
WiktorStarczewski merged 8 commits intomainfrom Apr 20, 2026
Merged
fix(mobile): use @miden-sdk/miden-sdk/lazy and @miden-sdk/react/lazy#191WiktorStarczewski merged 8 commits intomainfrom
WiktorStarczewski merged 8 commits intomainfrom
Conversation
The SDK's default entry (post-split) awaits WASM at module top level via TLA for ergonomic dApp use. Capacitor's `capacitor://localhost` scheme handler interacts poorly with that TLA — it hangs the host WebView indefinitely and the React tree never mounts. Verified against the iOS E2E suite on devnet: TLA in the Cargo glue → 1 fail, 6 skipped; `/lazy` everywhere → 7/7 passing in 8.6m. The dApp-browser WKWebView is unaffected (vanilla HTTPS, no Capacitor scheme handler). dApps can continue using the eager default. Wallet-side changes: - All `@miden-sdk/miden-sdk` imports in src/ → `/lazy`. - Two `@miden-sdk/react` imports → `/lazy` (useConsume, useImportStore). - jest.config.ts moduleNameMapper uses regex to map both eager and lazy paths to the same mock. - test/jest-mocks.ts registers the `/lazy` mock alongside the default for safety.
# Conflicts: # package.json
Bump moduleResolution to "bundler" so TS honors package.json exports field; bump eslint-import-resolver-typescript to ^3.9.1 for the same reason. Apply --fix for import/order on files affected by the resolver now correctly classifying @miden/dapp-browser.
Fixes mobile build failure on /lazy subpath imports. 0.14.3 aliased '@miden-sdk/miden-sdk' as a bare-string prefix match, so '@miden-sdk/miden-sdk/lazy' got rewritten to a non-existent file path and bypassed the SDK's exports map. 0.14.4 uses an exact-match regex.
- Version Bumping: rewrite for Vite (webpack references removed) - CDP Bridge: compress to a pointer (full recipe lives in memory file) - Haptic Feedback: drop component inventory (grep for patterns instead) - iOS E2E Empirical Status: mark as pre-/lazy-SDK baseline
Previous CLAUDE.md entry pointed at a user-local path under ~/.claude/projects/... which is incoherent for a shared repo. Move the bringup/usage/recovery material into a committed doc and link to it relatively from CLAUDE.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion PR to miden-client#2076. The Miden client SDKs are splitting into eager (default, top-level-await) and
/lazy(no TLA) entry points. The wallet's Capacitor host can't tolerate TLA — the custom-scheme WKWebView hangs on module evaluation — so all imports need to target the/lazysubpath.Why
capacitor://localhost'sWKURLSchemeHandlerinteracts poorly with top-levelawaitin the main WebView. Re-verified by temporarily restoring TLA in the Cargo glue and running the iOS E2E suite on devnet:/lazy(this PR)Total: 7/7 pass in 8.6m, identical to the pre-split baseline.
The dApp-browser WKWebView (vanilla HTTPS, no scheme handler) is NOT affected — TLA resolves in ~70ms there. dApps can continue using the default (eager) entry.
Changes
src/**/*.{ts,tsx}— all@miden-sdk/miden-sdkimports rewritten to@miden-sdk/miden-sdk/lazy(26 files).src/screens/consuming-note/ConsumingNote.tsx+src/screens/onboarding/import-wallet-flow/ImportWalletFile.tsx— the two@miden-sdk/reactimports switched to@miden-sdk/react/lazy.jest.config.ts—moduleNameMapperuses regex^@miden-sdk/miden-sdk(/lazy)?$and^@miden-sdk/react(/lazy)?$so both entries map to the same mock.test/jest-mocks.ts— addsjest.mock('@miden-sdk/react/lazy')alongside the default.CHANGELOG.md— 1.14.2 fix entry describing the import switch and the reason.Test plan
yarn test:e2e:mobile:devnet— 7/7 passing (iPhone 17 sim pair, devnet)