Skip to content

Fix Dioxus runtime error in WASM initialization - #5

Merged
aljazceru merged 1 commit into
mainfrom
claude/fix-dioxus-runtime-error-0128TkxNZVuQv6GC9UV47Rru
Nov 17, 2025
Merged

aljazceru merged 1 commit into
mainfrom
claude/fix-dioxus-runtime-error-0128TkxNZVuQv6GC9UV47Rru

Conversation

@aljazceru

Copy link
Copy Markdown
Contributor

Resolves runtime panic "Must be called from inside a Dioxus runtime" by moving init_nostr_client() from lib.rs::init() (which runs before the runtime starts) to the App component using use_effect (which runs inside the runtime context).

The GlobalSignal and spawn() APIs require the Dioxus runtime to be active, so initializing the Nostr client must happen after dioxus::launch() has started.

Changes:

  • src/lib.rs: Removed init_nostr_client() call from init()
  • src/main.rs: Added use_effect hook in App component to initialize the Nostr client within the runtime context

Fixes the error:
panicked at dioxus-core-0.7.1/src/runtime.rs:100:17: Must be called from inside a Dioxus runtime.

Resolves runtime panic "Must be called from inside a Dioxus runtime"
by moving init_nostr_client() from lib.rs::init() (which runs before
the runtime starts) to the App component using use_effect (which runs
inside the runtime context).

The GlobalSignal and spawn() APIs require the Dioxus runtime to be
active, so initializing the Nostr client must happen after
dioxus::launch() has started.

Changes:
- src/lib.rs: Removed init_nostr_client() call from init()
- src/main.rs: Added use_effect hook in App component to initialize
  the Nostr client within the runtime context

Fixes the error:
panicked at dioxus-core-0.7.1/src/runtime.rs:100:17:
Must be called from inside a Dioxus runtime.
@aljazceru
aljazceru merged commit 882a24f into main Nov 17, 2025
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants