diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b5dc0be0..d4386ff5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -11,7 +11,7 @@ import {page} from "$app/stores" import {sync, throttled} from "@welshman/store" import {always, call} from "@welshman/lib" - import {defaultSocketPolicies, netContext} from "@welshman/net" + import {defaultSocketPolicies, netContext, Pool} from "@welshman/net" import {appContext, pubkey, sessions, signerLog, shouldUnwrap} from "@welshman/app" import {routerContext} from "@welshman/router" import {verifyEvent} from "@welshman/util" @@ -248,6 +248,9 @@ // Initialize background notifications unsubscribers.push(Push.sync()) + // Any time our pubkey changes, close all connections + pubkey.subscribe(() => Pool.get().clear()) + // Listen for signer errors, report to user via toast unsubscribers.push( throttled(10_000, signerLog).subscribe($log => {