Whenever our pubkey changes clear connections and reopen

This commit is contained in:
Jon Staab 2026-07-06 11:40:00 -07:00
parent 00b3fe054c
commit f20414975d

View file

@ -11,7 +11,7 @@
import {page} from "$app/stores" import {page} from "$app/stores"
import {sync, throttled} from "@welshman/store" import {sync, throttled} from "@welshman/store"
import {always, call} from "@welshman/lib" 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 {appContext, pubkey, sessions, signerLog, shouldUnwrap} from "@welshman/app"
import {routerContext} from "@welshman/router" import {routerContext} from "@welshman/router"
import {verifyEvent} from "@welshman/util" import {verifyEvent} from "@welshman/util"
@ -248,6 +248,9 @@
// Initialize background notifications // Initialize background notifications
unsubscribers.push(Push.sync()) 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 // Listen for signer errors, report to user via toast
unsubscribers.push( unsubscribers.push(
throttled(10_000, signerLog).subscribe($log => { throttled(10_000, signerLog).subscribe($log => {