Skip to content

Commit 8f81cf4

Browse files
committed
Disable mock-from-exchange & resend for websockets
1 parent 16c9403 commit 8f81cf4

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/components/view/http/http-details-footer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ export const HttpDetailsFooter = inject('rulesStore')(
152152
}
153153

154154
<MockButton
155-
isExchange={event.isHttp()}
155+
isExchange={event.isHttp() && !event.isWebSocket()}
156156
isPaidUser={props.isPaidUser}
157157
onClick={() => props.onBuildRuleFromExchange(props.event as HttpExchange)}
158158
/>
159159
{ props.onPrepareToResendRequest &&
160160
<SendButton
161-
isExchange={event.isHttp()}
161+
isExchange={event.isHttp() && !event.isWebSocket()}
162162
isPaidUser={props.isPaidUser}
163163
onClick={() => props.onPrepareToResendRequest!(props.event as HttpExchange)}
164164
/>

src/components/view/view-page.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ const ViewPageKeyboardShortcuts = (props: {
6868
onClear: () => void,
6969
onStartSearch: () => void
7070
}) => {
71+
const selectedEvent = props.selectedEvent;
72+
7173
useHotkeys('j', (event) => {
7274
if (isEditable(event.target)) return;
7375
props.moveSelection(1);
@@ -79,33 +81,33 @@ const ViewPageKeyboardShortcuts = (props: {
7981
}, [props.moveSelection]);
8082

8183
useHotkeys('Ctrl+p, Cmd+p', (event) => {
82-
if (props.selectedEvent?.isHttp()) {
83-
props.onPin(props.selectedEvent);
84+
if (selectedEvent?.isHttp()) {
85+
props.onPin(selectedEvent);
8486
event.preventDefault();
8587
}
86-
}, [props.selectedEvent, props.onPin]);
88+
}, [selectedEvent, props.onPin]);
8789

8890
useHotkeys('Ctrl+r, Cmd+r', (event) => {
89-
if (props.isPaidUser && props.selectedEvent?.isHttp()) {
90-
props.onResend(props.selectedEvent);
91+
if (props.isPaidUser && selectedEvent?.isHttp() && !selectedEvent?.isWebSocket()) {
92+
props.onResend(selectedEvent);
9193
event.preventDefault();
9294
}
93-
}, [props.selectedEvent, props.onResend, props.isPaidUser]);
95+
}, [selectedEvent, props.onResend, props.isPaidUser]);
9496

9597
useHotkeys('Ctrl+m, Cmd+m', (event) => {
96-
if (props.isPaidUser && props.selectedEvent?.isHttp()) {
97-
props.onMockRequest(props.selectedEvent);
98+
if (props.isPaidUser && selectedEvent?.isHttp() && !selectedEvent?.isWebSocket()) {
99+
props.onMockRequest(selectedEvent);
98100
event.preventDefault();
99101
}
100-
}, [props.selectedEvent, props.onMockRequest, props.isPaidUser]);
102+
}, [selectedEvent, props.onMockRequest, props.isPaidUser]);
101103

102104
useHotkeys('Ctrl+Delete, Cmd+Delete', (event) => {
103105
if (isEditable(event.target)) return;
104106

105-
if (props.selectedEvent) {
106-
props.onDelete(props.selectedEvent);
107+
if (selectedEvent) {
108+
props.onDelete(selectedEvent);
107109
}
108-
}, [props.selectedEvent, props.onDelete]);
110+
}, [selectedEvent, props.onDelete]);
109111

110112
useHotkeys('Ctrl+Shift+Delete, Cmd+Shift+Delete', (event) => {
111113
props.onClear();

0 commit comments

Comments
 (0)