Skip to content

Commit 8a550ed

Browse files
committed
fix: fire onPeerDisconnect before session cleanup mutates meta
_emitSessionDisconnected -> streaming's _onSessionDisconnected clears meta.subscribedStreams in place. onPeerDisconnect ran after that, so consumers never saw the raw session meta the doc comment promises. Also updates the adapters/dev API snapshot for the new onPeerConnect/onPeerDisconnect options, which CI caught as stale.
1 parent d6c894e commit 8a550ed

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/devframe/src/node/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ export async function startHttpAndWs(options: StartHttpAndWsOptions): Promise<St
232232
}
233233
: undefined,
234234
onDisconnected: (peer, meta) => {
235-
rpcHost._emitSessionDisconnected(meta)
236235
options.onPeerDisconnect?.(peer, meta)
236+
rpcHost._emitSessionDisconnected(meta)
237237
},
238238
})
239239

tests/__snapshots__/tsnapi/devframe/adapters/dev.snapshot.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface CreateDevServerOptions {
1313
openBrowser?: boolean | string;
1414
auth?: boolean | DevframeAuthHandler;
1515
mcp?: boolean | McpRouteOptions;
16+
onPeerConnect?: (_: Peer, _: DevframeNodeRpcSession) => void;
17+
onPeerDisconnect?: (_: Peer, _: DevframeNodeRpcSessionMeta) => void;
1618
onReady?: (_: {
1719
origin: string;
1820
port: number;

0 commit comments

Comments
 (0)