mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 02:39:04 +08:00
fix: logs context not working because of incorrect request data (#5595)
This commit is contained in:
parent
d9e94a4067
commit
a8e4359d95
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable sonarjs/cognitive-complexity */
|
||||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import {
|
import {
|
||||||
@ -46,6 +47,8 @@ export const useContextLogData = ({
|
|||||||
} => {
|
} => {
|
||||||
const [logs, setLogs] = useState<ILog[]>([]);
|
const [logs, setLogs] = useState<ILog[]>([]);
|
||||||
|
|
||||||
|
const [lastLog, setLastLog] = useState<ILog>(log);
|
||||||
|
|
||||||
const orderByTimestamp = useMemo(() => getOrderByTimestamp(order), [order]);
|
const orderByTimestamp = useMemo(() => getOrderByTimestamp(order), [order]);
|
||||||
|
|
||||||
const logsMorePageSize = useMemo(() => (page - 1) * LOGS_MORE_PAGE_SIZE, [
|
const logsMorePageSize = useMemo(() => (page - 1) * LOGS_MORE_PAGE_SIZE, [
|
||||||
@ -71,11 +74,11 @@ export const useContextLogData = ({
|
|||||||
getRequestData({
|
getRequestData({
|
||||||
stagedQueryData: currentStagedQueryData,
|
stagedQueryData: currentStagedQueryData,
|
||||||
query,
|
query,
|
||||||
log,
|
log: lastLog,
|
||||||
orderByTimestamp,
|
orderByTimestamp,
|
||||||
page,
|
page,
|
||||||
}),
|
}),
|
||||||
[currentStagedQueryData, page, log, query, orderByTimestamp],
|
[currentStagedQueryData, query, lastLog, orderByTimestamp, page],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [requestData, setRequestData] = useState<Query | null>(
|
const [requestData, setRequestData] = useState<Query | null>(
|
||||||
@ -95,8 +98,10 @@ export const useContextLogData = ({
|
|||||||
if (order === ORDERBY_FILTERS.ASC) {
|
if (order === ORDERBY_FILTERS.ASC) {
|
||||||
const reversedCurrentLogs = currentLogs.reverse();
|
const reversedCurrentLogs = currentLogs.reverse();
|
||||||
setLogs([...reversedCurrentLogs]);
|
setLogs([...reversedCurrentLogs]);
|
||||||
|
setLastLog(reversedCurrentLogs[0]);
|
||||||
} else {
|
} else {
|
||||||
setLogs([...currentLogs]);
|
setLogs([...currentLogs]);
|
||||||
|
setLastLog(currentLogs[currentLogs.length - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -118,7 +123,7 @@ export const useContextLogData = ({
|
|||||||
const newRequestData = getRequestData({
|
const newRequestData = getRequestData({
|
||||||
stagedQueryData: currentStagedQueryData,
|
stagedQueryData: currentStagedQueryData,
|
||||||
query,
|
query,
|
||||||
log,
|
log: lastLog,
|
||||||
orderByTimestamp,
|
orderByTimestamp,
|
||||||
page: page + 1,
|
page: page + 1,
|
||||||
pageSize: LOGS_MORE_PAGE_SIZE,
|
pageSize: LOGS_MORE_PAGE_SIZE,
|
||||||
@ -131,6 +136,7 @@ export const useContextLogData = ({
|
|||||||
query,
|
query,
|
||||||
page,
|
page,
|
||||||
order,
|
order,
|
||||||
|
lastLog,
|
||||||
currentStagedQueryData,
|
currentStagedQueryData,
|
||||||
isDisabledFetch,
|
isDisabledFetch,
|
||||||
orderByTimestamp,
|
orderByTimestamp,
|
||||||
@ -142,7 +148,7 @@ export const useContextLogData = ({
|
|||||||
const newRequestData = getRequestData({
|
const newRequestData = getRequestData({
|
||||||
stagedQueryData: currentStagedQueryData,
|
stagedQueryData: currentStagedQueryData,
|
||||||
query,
|
query,
|
||||||
log,
|
log: lastLog,
|
||||||
orderByTimestamp,
|
orderByTimestamp,
|
||||||
page: 1,
|
page: 1,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user