Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mizu
Commits
a527fc6c
Unverified
Commit
a527fc6c
authored
3 years ago
by
lirazyehezkel
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
FE miss WS entries (#1010)
parent
e104128d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ui-common/src/components/TrafficViewer/EntriesList.tsx
+18
-10
ui-common/src/components/TrafficViewer/EntriesList.tsx
with
18 additions
and
10 deletions
+18
-10
ui-common/src/components/TrafficViewer/EntriesList.tsx
+
18
-
10
View file @
a527fc6c
...
...
@@ -118,23 +118,31 @@ export const EntriesList: React.FC<EntriesListProps> = ({
const
scrollbarVisible
=
scrollableRef
.
current
?.
childWrapperRef
.
current
.
clientHeight
>
scrollableRef
.
current
?.
wrapperRef
.
current
.
clientHeight
;
useEffect
(()
=>
{
if
(
!
focusedEntryId
&&
entries
.
length
>
0
)
setFocusedEntryId
(
entries
[
0
].
id
);
},
[
focusedEntryId
,
entries
])
useEffect
(()
=>
{
const
newEntries
=
[...
entries
];
if
(
newEntries
.
length
>
10000
)
{
setLeftOffTop
(
newEntries
[
0
].
id
);
newEntries
.
splice
(
0
,
newEntries
.
length
-
10000
)
setNoMoreDataTop
(
false
);
setEntries
(
newEntries
);
}
},
[
entries
])
if
(
ws
.
current
)
{
if
(
ws
.
current
&&
!
ws
.
current
.
onmessage
)
{
ws
.
current
.
onmessage
=
(
e
)
=>
{
if
(
!
e
?.
data
)
return
;
const
message
=
JSON
.
parse
(
e
.
data
);
switch
(
message
.
messageType
)
{
case
"
entry
"
:
const
entry
=
message
.
data
;
if
(
!
focusedEntryId
)
setFocusedEntryId
(
entry
.
id
);
const
newEntries
=
[...
entries
,
entry
];
if
(
newEntries
.
length
>
10000
)
{
setLeftOffTop
(
newEntries
[
0
].
id
);
newEntries
.
splice
(
0
,
newEntries
.
length
-
10000
)
setNoMoreDataTop
(
false
);
}
setEntries
(
newEntries
);
setEntries
(
entriesState
=>
{
const
newEntries
=
[...
entriesState
,
message
.
data
];
return
newEntries
;
});
break
;
case
"
status
"
:
setTappingStatus
(
message
.
tappingStatus
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment