@@ -68,6 +68,8 @@ const ViewPageKeyboardShortcuts = (props: {
68
68
onClear : ( ) => void ,
69
69
onStartSearch : ( ) => void
70
70
} ) => {
71
+ const selectedEvent = props . selectedEvent ;
72
+
71
73
useHotkeys ( 'j' , ( event ) => {
72
74
if ( isEditable ( event . target ) ) return ;
73
75
props . moveSelection ( 1 ) ;
@@ -79,33 +81,33 @@ const ViewPageKeyboardShortcuts = (props: {
79
81
} , [ props . moveSelection ] ) ;
80
82
81
83
useHotkeys ( 'Ctrl+p, Cmd+p' , ( event ) => {
82
- if ( props . selectedEvent ?. isHttp ( ) ) {
83
- props . onPin ( props . selectedEvent ) ;
84
+ if ( selectedEvent ?. isHttp ( ) ) {
85
+ props . onPin ( selectedEvent ) ;
84
86
event . preventDefault ( ) ;
85
87
}
86
- } , [ props . selectedEvent , props . onPin ] ) ;
88
+ } , [ selectedEvent , props . onPin ] ) ;
87
89
88
90
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 ) ;
91
93
event . preventDefault ( ) ;
92
94
}
93
- } , [ props . selectedEvent , props . onResend , props . isPaidUser ] ) ;
95
+ } , [ selectedEvent , props . onResend , props . isPaidUser ] ) ;
94
96
95
97
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 ) ;
98
100
event . preventDefault ( ) ;
99
101
}
100
- } , [ props . selectedEvent , props . onMockRequest , props . isPaidUser ] ) ;
102
+ } , [ selectedEvent , props . onMockRequest , props . isPaidUser ] ) ;
101
103
102
104
useHotkeys ( 'Ctrl+Delete, Cmd+Delete' , ( event ) => {
103
105
if ( isEditable ( event . target ) ) return ;
104
106
105
- if ( props . selectedEvent ) {
106
- props . onDelete ( props . selectedEvent ) ;
107
+ if ( selectedEvent ) {
108
+ props . onDelete ( selectedEvent ) ;
107
109
}
108
- } , [ props . selectedEvent , props . onDelete ] ) ;
110
+ } , [ selectedEvent , props . onDelete ] ) ;
109
111
110
112
useHotkeys ( 'Ctrl+Shift+Delete, Cmd+Shift+Delete' , ( event ) => {
111
113
props . onClear ( ) ;
0 commit comments