Файли
openidea/src/features/debugger/js/networkSessions.ts
T
ntbang0901 f0f15366e4 feat(debugger): Network tab for a debugged page (#3315)
A page session gets a Network tab in the Debug tool window: the page's requests with status, method, type, size and time, filtered by URL, resource kind and My code only (a request sent through a library is attributed to the project code that called it). A request shows its headers, response body (text, cut at 1 MB) and initiator; Break on Next Request turns it into a request breakpoint, and Reload Page loads the page again. js-debug's enableNetworking is asked once the page's launch is answered; a js-debug that doesn't report requests says so in the tab.

Co-authored-by: ntbang0901 <[email protected]>
2026-11-14 16:37:23 +08:00

14 рядки
510 B
TypeScript

import { useDebug } from "../state";
import { forgetNetwork, useJsNetwork } from "./network";
/**
* Drops a session's requests when the session is removed. (Recording itself starts in the
* backend with the page session, so that the page's load is in the list.) Returns the
* unsubscribe function.
*/
export function watchNetworkSessions(): () => void {
return useDebug.subscribe((s) => {
for (const id of Object.keys(useJsNetwork.getState().rows)) if (!s.sessions[+id]) forgetNetwork(+id);
});
}