Created
December 15, 2021 05:40
-
-
Save jasonLaster/4a50250202e75e73ba375faed3293c2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/ui/actions/network.ts b/src/ui/actions/network.ts | |
index 908fdbf2..3792fb05 100644 | |
--- a/src/ui/actions/network.ts | |
+++ b/src/ui/actions/network.ts | |
@@ -9,6 +9,14 @@ type NewNetworkRequestsAction = { | |
export type NetworkAction = NewNetworkRequestsAction; | |
+export function fetchFrames(point: string) { | |
+ return async ({ dispatch, threadFront }) => { | |
+ const pause = threadFront.ensurePause(point); | |
+ const frames = await pause.getFrames(); | |
+ dispatch({ type: "set_frames", frames, point }); | |
+ }; | |
+} | |
+ | |
export const newNetworkRequestsAction = ({ | |
requests, | |
events, | |
diff --git a/src/ui/reducers/network.ts b/src/ui/reducers/network.ts | |
index 61ec5edf..b183d319 100644 | |
--- a/src/ui/reducers/network.ts | |
+++ b/src/ui/reducers/network.ts | |
@@ -11,6 +11,7 @@ export type NetworkState = { | |
const initialState = (): NetworkState => ({ | |
events: [], | |
requests: [], | |
+ frames: {}, | |
}); | |
const update = (state: NetworkState = initialState(), action: NetworkAction): NetworkState => { | |
@@ -20,6 +21,9 @@ const update = (state: NetworkState = initialState(), action: NetworkAction): Ne | |
events: [...action.payload.events, ...state.events], | |
requests: [...action.payload.requests, ...state.requests], | |
}; | |
+ case "set_frames": { | |
+ return { ...frames, [action.point]: action.frames }; | |
+ } | |
default: | |
return state; | |
} | |
@@ -27,5 +31,5 @@ const update = (state: NetworkState = initialState(), action: NetworkAction): Ne | |
export const getEvents = (state: UIState) => state.network.events; | |
export const getRequests = (state: UIState) => state.network.requests; | |
- | |
+export const getFramesForPoint = (state: UIState, point: string) => state.network.frames[point]; | |
export default update; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment