mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Terminal output] fix to a regression in the last pr (#140838)
* fix to a regression in the last pr * fix to a regression in the last pr Co-authored-by: Karl Godard <karlgodard@elastic.co>
This commit is contained in:
parent
d0a0a8f889
commit
2464aa69b7
1 changed files with 11 additions and 4 deletions
|
@ -64,10 +64,12 @@ export const useFetchSessionViewProcessEvents = (
|
|||
getNextPageParam: (lastPage, pages) => {
|
||||
const isRefetch = pages.length === 1 && jumpToCursor;
|
||||
if (isRefetch || lastPage.events.length >= PROCESS_EVENTS_PER_PAGE) {
|
||||
const cursor = lastPage.events.filter((event) => {
|
||||
const filtered = lastPage.events.filter((event) => {
|
||||
const action = event.event?.action;
|
||||
return action && [EventAction.fork, EventAction.exec, EventAction.end].includes(action);
|
||||
})?.[lastPage.events.length - 1]?.['@timestamp'];
|
||||
});
|
||||
|
||||
const cursor = filtered?.[filtered.length - 1]?.['@timestamp'];
|
||||
|
||||
if (cursor) {
|
||||
return {
|
||||
|
@ -78,12 +80,17 @@ export const useFetchSessionViewProcessEvents = (
|
|||
}
|
||||
},
|
||||
getPreviousPageParam: (firstPage, pages) => {
|
||||
const atBeginning = pages.length > 1 && firstPage.events.length < PROCESS_EVENTS_PER_PAGE;
|
||||
const filtered = firstPage.events.filter((event) => {
|
||||
const action = event.event?.action;
|
||||
return action && [EventAction.fork, EventAction.exec, EventAction.end].includes(action);
|
||||
});
|
||||
|
||||
const atBeginning = pages.length > 1 && filtered.length < PROCESS_EVENTS_PER_PAGE;
|
||||
|
||||
if (jumpToCursor && !atBeginning) {
|
||||
// it's possible the first page returned no events
|
||||
// fallback to using jumpToCursor if there are no "forward" events.
|
||||
const cursor = firstPage.events?.[0]?.['@timestamp'] || jumpToCursor;
|
||||
const cursor = filtered[0]?.['@timestamp'] || jumpToCursor;
|
||||
|
||||
return {
|
||||
cursor,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue